Class: OCI::Onesubscription::Models::InvoiceLineSummary

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

Overview

Invoice Line

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):



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 80

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

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

  self.ar_invoice_number = attributes[:'arInvoiceNumber'] if attributes[:'arInvoiceNumber']

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

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

  self.data_center = attributes[:'dataCenter'] if attributes[:'dataCenter']

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

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

  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']
end

Instance Attribute Details

#ar_invoice_numberString

AR Invoice Number for Invoice Line

Returns:

  • (String)


23
24
25
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 23

def ar_invoice_number
  @ar_invoice_number
end

#data_centerString

**[Required]** Data Center Attribute.

Returns:

  • (String)


28
29
30
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 28

def data_center
  @data_center
end

#idString

**[Required]** SPM Invoice Line internal identifier

Returns:

  • (String)


14
15
16
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 14

def id
  @id
end

#productOCI::Onesubscription::Models::InvoicingProduct

This attribute is required.



18
19
20
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 18

def product
  @product
end

#time_endDateTime

**[Required]** Usage end time

Returns:

  • (DateTime)


38
39
40
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 38

def time_end
  @time_end
end

#time_startDateTime

**[Required]** Usage start time

Returns:

  • (DateTime)


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

def time_start
  @time_start
end

Class Method Details

.attribute_mapObject

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



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'product': :'product',
    'ar_invoice_number': :'arInvoiceNumber',
    'data_center': :'dataCenter',
    'time_start': :'timeStart',
    'time_end': :'timeEnd'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'product': :'OCI::Onesubscription::Models::InvoicingProduct',
    'ar_invoice_number': :'String',
    'data_center': :'String',
    'time_start': :'DateTime',
    'time_end': :'DateTime'
    # 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



122
123
124
125
126
127
128
129
130
131
132
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 122

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

  self.class == other.class &&
    id == other.id &&
    product == other.product &&
    ar_invoice_number == other.ar_invoice_number &&
    data_center == other.data_center &&
    time_start == other.time_start &&
    time_end == other.time_end
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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 157

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


137
138
139
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 137

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



146
147
148
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 146

def hash
  [id, product, ar_invoice_number, data_center, time_start, time_end].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



190
191
192
193
194
195
196
197
198
199
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 190

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



184
185
186
# File 'lib/oci/onesubscription/models/invoice_line_summary.rb', line 184

def to_s
  to_hash.to_s
end