Class: Yapstone::MarketplaceProductUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/yapstone-so/models/marketplace_product_update.rb

Overview

Update marketplace product in a contract.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MarketplaceProductUpdate

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 113

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Yapstone::MarketplaceProductUpdate` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Yapstone::MarketplaceProductUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'consents')
    if (value = attributes[:'consents']).is_a?(Array)
      self.consents = value
    end
  end

  if attributes.key?(:'asset_id')
    self.asset_id = attributes[:'asset_id']
  end

  if attributes.key?(:'payout_mode')
    self.payout_mode = attributes[:'payout_mode']
  end

  if attributes.key?(:'settlement_currency')
    self.settlement_currency = attributes[:'settlement_currency']
  end

  if attributes.key?(:'subscription_type')
    self.subscription_type = attributes[:'subscription_type']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'charges_status')
    self.charges_status = attributes[:'charges_status']
  end

  if attributes.key?(:'refund_status')
    self.refund_status = attributes[:'refund_status']
  end

  if attributes.key?(:'token_for_processing')
    self.token_for_processing = attributes[:'token_for_processing']
  end

  if attributes.key?(:'payment_platform')
    self.payment_platform = attributes[:'payment_platform']
  end

  if attributes.key?(:'payout_instruments')
    if (value = attributes[:'payout_instruments']).is_a?(Array)
      self.payout_instruments = value
    end
  end
end

Instance Attribute Details

#asset_idObject

The unique id of the Asset Resource.



22
23
24
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 22

def asset_id
  @asset_id
end

#charges_statusObject

Returns the value of attribute charges_status.



35
36
37
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 35

def charges_status
  @charges_status
end

#consentsObject

An array of consents.



19
20
21
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 19

def consents
  @consents
end

#payment_platformObject

The platform to initiate payments on.



43
44
45
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 43

def payment_platform
  @payment_platform
end

#payout_instrumentsObject

Returns the value of attribute payout_instruments.



45
46
47
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 45

def payout_instruments
  @payout_instruments
end

#payout_modeObject

The type of Payout Mode



25
26
27
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 25

def payout_mode
  @payout_mode
end

#refund_statusObject

Returns the value of attribute refund_status.



37
38
39
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 37

def refund_status
  @refund_status
end

#settlement_currencyObject

The ISO currency code enum for settlements.



28
29
30
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 28

def settlement_currency
  @settlement_currency
end

#statusObject

Returns the value of attribute status.



33
34
35
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 33

def status
  @status
end

#subscription_typeObject

Subscription Type



31
32
33
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 31

def subscription_type
  @subscription_type
end

#token_for_processingObject

The token to use when making payments.



40
41
42
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 40

def token_for_processing
  @token_for_processing
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
84
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 70

def self.attribute_map
  {
    :'consents' => :'consents',
    :'asset_id' => :'assetId',
    :'payout_mode' => :'payoutMode',
    :'settlement_currency' => :'settlementCurrency',
    :'subscription_type' => :'subscriptionType',
    :'status' => :'status',
    :'charges_status' => :'chargesStatus',
    :'refund_status' => :'refundStatus',
    :'token_for_processing' => :'tokenForProcessing',
    :'payment_platform' => :'paymentPlatform',
    :'payout_instruments' => :'payoutInstruments'
  }
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



245
246
247
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 245

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



104
105
106
107
108
109
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 104

def self.openapi_all_of
  [
  :'MarketplaceProductExtra',
  :'ProductWrite'
  ]
end

.openapi_typesObject

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 87

def self.openapi_types
  {
    :'consents' => :'Array<ConsentRequest>',
    :'asset_id' => :'String',
    :'payout_mode' => :'String',
    :'settlement_currency' => :'String',
    :'subscription_type' => :'String',
    :'status' => :'StatusReasonResource',
    :'charges_status' => :'ActionStatusResource',
    :'refund_status' => :'ActionStatusResource',
    :'token_for_processing' => :'String',
    :'payment_platform' => :'String',
    :'payout_instruments' => :'Array<MarketplaceProductPayoutInstrumentUpdate>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 214

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      consents == o.consents &&
      asset_id == o.asset_id &&
      payout_mode == o.payout_mode &&
      settlement_currency == o.settlement_currency &&
      subscription_type == o.subscription_type &&
      status == o.status &&
      charges_status == o.charges_status &&
      refund_status == o.refund_status &&
      token_for_processing == o.token_for_processing &&
      payment_platform == o.payment_platform &&
      payout_instruments == o.payout_instruments
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



273
274
275
276
277
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
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 273

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
    Yapstone.const_get(type).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



338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 338

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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 252

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that 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


232
233
234
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 232

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



238
239
240
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 238

def hash
  [consents, asset_id, payout_mode, settlement_currency, subscription_type, status, charges_status, refund_status, token_for_processing, payment_platform, payout_instruments].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



177
178
179
180
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 177

def list_invalid_properties
  invalid_properties = Array.new
  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



318
319
320
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 318

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



324
325
326
327
328
329
330
331
332
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 324

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



312
313
314
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 312

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



184
185
186
187
188
189
190
# File 'lib/yapstone-so/models/marketplace_product_update.rb', line 184

def valid?
  payout_mode_validator = EnumAttributeValidator.new('String', ["POST_CHECK_IN", "POST_BOOKING", "NONE", "STANDARD", "ADVANCED"])
  return false unless payout_mode_validator.valid?(@payout_mode)
  payment_platform_validator = EnumAttributeValidator.new('String', ["DOMESTIC", "INTERNATIONAL"])
  return false unless payment_platform_validator.valid?(@payment_platform)
  true
end