Class: OCI::OspGateway::Models::InvoiceLineSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/osp_gateway/models/invoice_line_summary.rb

Overview

Product items of the invoice

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InvoiceLineSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :product (String)

    The value to assign to the #product property

  • :order_no (String)

    The value to assign to the #order_no property

  • :part_number (String)

    The value to assign to the #part_number property

  • :time_start (DateTime)

    The value to assign to the #time_start property

  • :time_end (DateTime)

    The value to assign to the #time_end property

  • :quantity (Float)

    The value to assign to the #quantity property

  • :net_unit_price (Float)

    The value to assign to the #net_unit_price property

  • :total_price (Float)

    The value to assign to the #total_price property

  • :currency (OCI::OspGateway::Models::Currency)

    The value to assign to the #currency property



95
96
97
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
140
141
142
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 95

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.product = attributes[:'product'] if attributes[:'product']

  self.order_no = attributes[:'orderNo'] if attributes[:'orderNo']

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

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

  self.part_number = attributes[:'partNumber'] if attributes[:'partNumber']

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

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

  self.time_start = attributes[:'timeStart'] if attributes[:'timeStart']

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

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

  self.time_end = attributes[:'timeEnd'] if attributes[:'timeEnd']

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

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

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

  self.net_unit_price = attributes[:'netUnitPrice'] if attributes[:'netUnitPrice']

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

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

  self.total_price = attributes[:'totalPrice'] if attributes[:'totalPrice']

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

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

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

Instance Attribute Details

#currencyOCI::OspGateway::Models::Currency



44
45
46
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 44

def currency
  @currency
end

#net_unit_priceFloat

Unit price of the ordered product

Returns:

  • (Float)


37
38
39
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 37

def net_unit_price
  @net_unit_price
end

#order_noString

Product of the item

Returns:

  • (String)


17
18
19
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 17

def order_no
  @order_no
end

#part_numberString

Part number

Returns:

  • (String)


21
22
23
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 21

def part_number
  @part_number
end

#productString

[Required] Product of the item

Returns:

  • (String)


13
14
15
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 13

def product
  @product
end

#quantityFloat

Quantity of the ordered product

Returns:

  • (Float)


33
34
35
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 33

def quantity
  @quantity
end

#time_endDateTime

End date

Returns:

  • (DateTime)


29
30
31
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 29

def time_end
  @time_end
end

#time_startDateTime

Start date

Returns:

  • (DateTime)


25
26
27
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 25

def time_start
  @time_start
end

#total_priceFloat

Total price of the ordered product (Net unit price x quantity)

Returns:

  • (Float)


41
42
43
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 41

def total_price
  @total_price
end

Class Method Details

.attribute_mapObject

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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 47

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'product': :'product',
    'order_no': :'orderNo',
    'part_number': :'partNumber',
    'time_start': :'timeStart',
    'time_end': :'timeEnd',
    'quantity': :'quantity',
    'net_unit_price': :'netUnitPrice',
    'total_price': :'totalPrice',
    'currency': :'currency'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 64

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'product': :'String',
    'order_no': :'String',
    'part_number': :'String',
    'time_start': :'DateTime',
    'time_end': :'DateTime',
    'quantity': :'Float',
    'net_unit_price': :'Float',
    'total_price': :'Float',
    'currency': :'OCI::OspGateway::Models::Currency'
    # 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



151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 151

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

  self.class == other.class &&
    product == other.product &&
    order_no == other.order_no &&
    part_number == other.part_number &&
    time_start == other.time_start &&
    time_end == other.time_end &&
    quantity == other.quantity &&
    net_unit_price == other.net_unit_price &&
    total_price == other.total_price &&
    currency == other.currency
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



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 189

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


169
170
171
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 169

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



178
179
180
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 178

def hash
  [product, order_no, part_number, time_start, time_end, quantity, net_unit_price, total_price, currency].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 222

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



216
217
218
# File 'lib/oci/osp_gateway/models/invoice_line_summary.rb', line 216

def to_s
  to_hash.to_s
end