Class: OCI::Onesubscription::Models::InvoicingPaymentTerm

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/onesubscription/models/invoicing_payment_term.rb

Overview

Payment Term details

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InvoicingPaymentTerm

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String) —

    The value to assign to the #name property

  • :value (String) —

    The value to assign to the #value property

  • :description (String) —

    The value to assign to the #description property

  • :is_active (BOOLEAN) —

    The value to assign to the #is_active property

  • :time_created (DateTime) —

    The value to assign to the #time_created property

  • :created_by (String) —

    The value to assign to the #created_by property

  • :time_updated (DateTime) —

    The value to assign to the #time_updated property

  • :updated_by (String) —

    The value to assign to the #updated_by property



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 98

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.name = attributes[:'name'] if attributes[:'name']

  self.value = attributes[:'value'] if attributes[:'value']

  self.description = attributes[:'description'] if attributes[:'description']

  self.is_active = attributes[:'isActive'] unless attributes[:'isActive'].nil?

  raise 'You cannot provide both :isActive and :is_active' if attributes.key?(:'isActive') && attributes.key?(:'is_active')

  self.is_active = attributes[:'is_active'] unless attributes[:'is_active'].nil?

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

  raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')

  self.time_created = attributes[:'time_created'] if attributes[:'time_created']

  self.created_by = attributes[:'createdBy'] if attributes[:'createdBy']

  raise 'You cannot provide both :createdBy and :created_by' if attributes.key?(:'createdBy') && attributes.key?(:'created_by')

  self.created_by = attributes[:'created_by'] if attributes[:'created_by']

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

  raise 'You cannot provide both :timeUpdated and :time_updated' if attributes.key?(:'timeUpdated') && attributes.key?(:'time_updated')

  self.time_updated = attributes[:'time_updated'] if attributes[:'time_updated']

  self.updated_by = attributes[:'updatedBy'] if attributes[:'updatedBy']

  raise 'You cannot provide both :updatedBy and :updated_by' if attributes.key?(:'updatedBy') && attributes.key?(:'updated_by')

  self.updated_by = attributes[:'updated_by'] if attributes[:'updated_by']
end

Instance Attribute Details

#created_by ⇒ String

User that created the Payment term

Returns:

  • (String)


40
41
42
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 40

def created_by
  @created_by
end

#description ⇒ String

Payment term Description

Returns:

  • (String)


25
26
27
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 25

def description
  @description
end

#is_active ⇒ BOOLEAN

Payment term active flag

Returns:

  • (BOOLEAN)


30
31
32
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 30

def is_active
  @is_active
end

#name ⇒ String

[Required] Payment Term name

Returns:

  • (String)


15
16
17
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 15

def name
  @name
end

#time_created ⇒ DateTime

Payment term last update date

Returns:

  • (DateTime)


35
36
37
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 35

def time_created
  @time_created
end

#time_updated ⇒ DateTime

Payment term last update date

Returns:

  • (DateTime)


45
46
47
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 45

def time_updated
  @time_updated
end

#updated_by ⇒ String

User that updated the Payment term

Returns:

  • (String)


50
51
52
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 50

def updated_by
  @updated_by
end

#value ⇒ String

Payment Term value

Returns:

  • (String)


20
21
22
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 20

def value
  @value
end

Class Method Details

.attribute_map ⇒ Object

Attribute mapping from ruby-style variable name to JSON key.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 53

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'value': :'value',
    'description': :'description',
    'is_active': :'isActive',
    'time_created': :'timeCreated',
    'created_by': :'createdBy',
    'time_updated': :'timeUpdated',
    'updated_by': :'updatedBy'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_types ⇒ Object

Attribute type mapping.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 69

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'value': :'String',
    'description': :'String',
    'is_active': :'BOOLEAN',
    'time_created': :'DateTime',
    'created_by': :'String',
    'time_updated': :'DateTime',
    'updated_by': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object) —

    the other object to be compared



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 148

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    name == other.name &&
    value == other.value &&
    description == other.description &&
    is_active == other.is_active &&
    time_created == other.time_created &&
    created_by == other.created_by &&
    time_updated == other.time_updated &&
    updated_by == other.updated_by
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 185

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object) —

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


165
166
167
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 165

def eql?(other)
  self == other
end

#hash ⇒ Fixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum) —

    Hash code



174
175
176
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 174

def hash
  [name, value, description, is_active, time_created, created_by, time_updated, updated_by].hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



218
219
220
221
222
223
224
225
226
227
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 218

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



212
213
214
# File 'lib/oci/onesubscription/models/invoicing_payment_term.rb', line 212

def to_s
  to_hash.to_s
end