Class: PostfinancecheckoutRubySdk::PaymentConnector

Inherits:
Object
  • Object
show all
Defined in:
lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PaymentConnector

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 140

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#data_collection_typeObject

Returns the value of attribute data_collection_type.



34
35
36
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 34

def data_collection_type
  @data_collection_type
end

#deprecatedObject

Whether the object was deprecated.



37
38
39
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 37

def deprecated
  @deprecated
end

#deprecation_reasonObject

The deprecation reason describes why the object was deprecated.



49
50
51
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 49

def deprecation_reason
  @deprecation_reason
end

#descriptionObject

The localized description of the object.



42
43
44
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 42

def description
  @description
end

#idObject

A unique identifier for the object.



60
61
62
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 60

def id
  @id
end

#nameObject

The localized name of the object.



55
56
57
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 55

def name
  @name
end

#payment_methodObject

Returns the value of attribute payment_method.



57
58
59
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 57

def payment_method
  @payment_method
end

#payment_method_brandObject

Returns the value of attribute payment_method_brand.



44
45
46
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 44

def payment_method_brand
  @payment_method_brand
end

#primary_risk_takerObject

Returns the value of attribute primary_risk_taker.



39
40
41
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 39

def primary_risk_taker
  @primary_risk_taker
end

#processorObject

Returns the value of attribute processor.



46
47
48
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 46

def processor
  @processor
end

#supported_currenciesObject

The currencies that are supported by the connector.



52
53
54
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 52

def supported_currencies
  @supported_currencies
end

#supported_customers_presencesObject

The types of customer’s presence that are supported by the connector.



32
33
34
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 32

def supported_customers_presences
  @supported_customers_presences
end

#supported_featuresObject

The features that are supported by the connector.



29
30
31
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 29

def supported_features
  @supported_features
end

Class Method Details

._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



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 323

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = PostfinancecheckoutRubySdk.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



104
105
106
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 104

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



109
110
111
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 109

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 85

def self.attribute_map
  {
    :'supported_features' => :'supportedFeatures',
    :'supported_customers_presences' => :'supportedCustomersPresences',
    :'data_collection_type' => :'dataCollectionType',
    :'deprecated' => :'deprecated',
    :'primary_risk_taker' => :'primaryRiskTaker',
    :'description' => :'description',
    :'payment_method_brand' => :'paymentMethodBrand',
    :'processor' => :'processor',
    :'deprecation_reason' => :'deprecationReason',
    :'supported_currencies' => :'supportedCurrencies',
    :'name' => :'name',
    :'payment_method' => :'paymentMethod',
    :'id' => :'id'
  }
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



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 299

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



133
134
135
136
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 133

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 114

def self.openapi_types
  {
    :'supported_features' => :'Array<PaymentConnectorFeature>',
    :'supported_customers_presences' => :'Array<CustomersPresence>',
    :'data_collection_type' => :'DataCollectionType',
    :'deprecated' => :'Boolean',
    :'primary_risk_taker' => :'PaymentPrimaryRiskTaker',
    :'description' => :'Hash<String, String>',
    :'payment_method_brand' => :'PaymentMethodBrand',
    :'processor' => :'PaymentProcessor',
    :'deprecation_reason' => :'Hash<String, String>',
    :'supported_currencies' => :'Array<String>',
    :'name' => :'Hash<String, String>',
    :'payment_method' => :'PaymentMethod',
    :'id' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 266

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      supported_features == o.supported_features &&
      supported_customers_presences == o.supported_customers_presences &&
      data_collection_type == o.data_collection_type &&
      deprecated == o.deprecated &&
      primary_risk_taker == o.primary_risk_taker &&
      description == o.description &&
      payment_method_brand == o.payment_method_brand &&
      processor == o.processor &&
      deprecation_reason == o.deprecation_reason &&
      supported_currencies == o.supported_currencies &&
      name == o.name &&
      payment_method == o.payment_method &&
      id == o.id
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



394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 394

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


286
287
288
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 286

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



292
293
294
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 292

def hash
  [supported_features, supported_customers_presences, data_collection_type, deprecated, primary_risk_taker, description, payment_method_brand, processor, deprecation_reason, supported_currencies, name, payment_method, id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



221
222
223
224
225
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 221

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  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



370
371
372
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 370

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



376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 376

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



364
365
366
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 364

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



229
230
231
232
# File 'lib/postfinancecheckout-ruby-sdk/models/payment_connector.rb', line 229

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end