Class: SamplifyAPIClient::LineItemItemData

Inherits:
Object
  • Object
show all
Defined in:
lib/samplify_api_client/models/line_item_item_data.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LineItemItemData

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
143
144
145
146
147
148
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 103

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 }

  if attributes.has_key?(:'countryISOCode')
    self.country_iso_code = attributes[:'countryISOCode']
  end

  if attributes.has_key?(:'createdAt')
    self.created_at = attributes[:'createdAt']
  end

  if attributes.has_key?(:'extLineItemId')
    self.ext_line_item_id = attributes[:'extLineItemId']
  end

  if attributes.has_key?(:'languageISOCode')
    self.language_iso_code = attributes[:'languageISOCode']
  end

  if attributes.has_key?(:'launchedAt')
    self.launched_at = attributes[:'launchedAt']
  end

  if attributes.has_key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.has_key?(:'stateLastUpdatedAt')
    self.state_last_updated_at = attributes[:'stateLastUpdatedAt']
  end

  if attributes.has_key?(:'stateReason')
    self.state_reason = attributes[:'stateReason']
  end

  if attributes.has_key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.has_key?(:'updatedAt')
    self.updated_at = attributes[:'updatedAt']
  end
end

Instance Attribute Details

#country_iso_codeObject

2 letter ISO Country Code



18
19
20
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 18

def country_iso_code
  @country_iso_code
end

#created_atObject

Timestamp of when the line item was created



21
22
23
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 21

def created_at
  @created_at
end

#ext_line_item_idObject

A unique identifier for your Line Item



24
25
26
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 24

def ext_line_item_id
  @ext_line_item_id
end

#language_iso_codeObject

2 letter ISO Language Code



27
28
29
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 27

def language_iso_code
  @language_iso_code
end

#launched_atObject

Timestamp of when the line item launched on RN SSI panelists



30
31
32
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 30

def launched_at
  @launched_at
end

#stateObject

The current state of the line item: PROVISIONED, AWAITING_APPROVAL, LAUNCHED, PAUSED, CLOSED, INVOICED



33
34
35
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 33

def state
  @state
end

#state_last_updated_atObject

Timestamp of when the line item last changed its state



36
37
38
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 36

def state_last_updated_at
  @state_last_updated_at
end

#state_reasonObject

Reason for the current state of the line item



39
40
41
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 39

def state_reason
  @state_reason
end

#titleObject

A Line Item title



42
43
44
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 42

def title
  @title
end

#updated_atObject

Timestamp of when the line item was updated



45
46
47
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 45

def updated_at
  @updated_at
end

Class Method Details

.attribute_mapObject

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



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 70

def self.attribute_map
  {
    :'country_iso_code' => :'countryISOCode',
    :'created_at' => :'createdAt',
    :'ext_line_item_id' => :'extLineItemId',
    :'language_iso_code' => :'languageISOCode',
    :'launched_at' => :'launchedAt',
    :'state' => :'state',
    :'state_last_updated_at' => :'stateLastUpdatedAt',
    :'state_reason' => :'stateReason',
    :'title' => :'title',
    :'updated_at' => :'updatedAt'
  }
end

.swagger_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 86

def self.swagger_types
  {
    :'country_iso_code' => :'String',
    :'created_at' => :'String',
    :'ext_line_item_id' => :'String',
    :'language_iso_code' => :'String',
    :'launched_at' => :'',
    :'state' => :'String',
    :'state_last_updated_at' => :'String',
    :'state_reason' => :'String',
    :'title' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 227

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      country_iso_code == o.country_iso_code &&
      created_at == o.created_at &&
      ext_line_item_id == o.ext_line_item_id &&
      language_iso_code == o.language_iso_code &&
      launched_at == o.launched_at &&
      state == o.state &&
      state_last_updated_at == o.state_last_updated_at &&
      state_reason == o.state_reason &&
      title == o.title &&
      updated_at == o.updated_at
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 278

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = SamplifyAPIClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 344

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  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



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 257

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/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)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


244
245
246
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 244

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



250
251
252
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 250

def hash
  [country_iso_code, created_at, ext_line_item_id, language_iso_code, launched_at, state, state_last_updated_at, state_reason, title, updated_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 152

def list_invalid_properties
  invalid_properties = Array.new
  if @country_iso_code.nil?
    invalid_properties.push('invalid value for "country_iso_code", country_iso_code cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @ext_line_item_id.nil?
    invalid_properties.push('invalid value for "ext_line_item_id", ext_line_item_id cannot be nil.')
  end

  if @language_iso_code.nil?
    invalid_properties.push('invalid value for "language_iso_code", language_iso_code cannot be nil.')
  end

  if @launched_at.nil?
    invalid_properties.push('invalid value for "launched_at", launched_at cannot be nil.')
  end

  if @state.nil?
    invalid_properties.push('invalid value for "state", state cannot be nil.')
  end

  if @state_last_updated_at.nil?
    invalid_properties.push('invalid value for "state_last_updated_at", state_last_updated_at cannot be nil.')
  end

  if @state_reason.nil?
    invalid_properties.push('invalid value for "state_reason", state_reason cannot be nil.')
  end

  if @title.nil?
    invalid_properties.push('invalid value for "title", title cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



324
325
326
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 324

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



330
331
332
333
334
335
336
337
338
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 330

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



318
319
320
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 318

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/samplify_api_client/models/line_item_item_data.rb', line 199

def valid?
  return false if @country_iso_code.nil?
  return false if @created_at.nil?
  return false if @ext_line_item_id.nil?
  return false if @language_iso_code.nil?
  return false if @launched_at.nil?
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ['PROVISIONED', 'AWAITING_APPROVAL', 'LAUNCHED', 'PAUSED', 'CLOSED', 'INVOICED'])
  return false unless state_validator.valid?(@state)
  return false if @state_last_updated_at.nil?
  return false if @state_reason.nil?
  return false if @title.nil?
  return false if @updated_at.nil?
  true
end