Class: UltracartClient::PaymentsConfigurationRestrictions

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/payments_configuration_restrictions.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PaymentsConfigurationRestrictions

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 121

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?(:'descriptions')
    if (value = attributes[:'descriptions']).is_a?(Array)
      self.descriptions = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#descriptionsObject

Returns the value of attribute descriptions.



17
18
19
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 17

def descriptions
  @descriptions
end

#maximum_subtotalObject

Maximum subtotal



20
21
22
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 20

def maximum_subtotal
  @maximum_subtotal
end

#minimum_subtotalObject

Minimum subtotal



23
24
25
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 23

def minimum_subtotal
  @minimum_subtotal
end

#payment_methodObject

Payment method



26
27
28
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 26

def payment_method
  @payment_method
end

#restriction_alaska_hawaiiObject

Alaska and Hawaii restriction



29
30
31
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 29

def restriction_alaska_hawaii
  @restriction_alaska_hawaii
end

#restriction_apo_fpoObject

APO/FPO restriction



32
33
34
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 32

def restriction_apo_fpo
  @restriction_apo_fpo
end

#restriction_canadaObject

Canada restriction



35
36
37
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 35

def restriction_canada
  @restriction_canada
end

#restriction_continental_usObject

Continental US restriction



38
39
40
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 38

def restriction_continental_us
  @restriction_continental_us
end

#restriction_domestic_onlyObject

Domestic only restriction



41
42
43
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 41

def restriction_domestic_only
  @restriction_domestic_only
end

#restriction_international_onlyObject

International only restriction



44
45
46
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 44

def restriction_international_only
  @restriction_international_only
end

#restriction_po_boxObject

PO Box restriction



47
48
49
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 47

def restriction_po_box
  @restriction_po_box
end

#restriction_puerto_ricoObject

Puerto Rico restriction



50
51
52
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 50

def restriction_puerto_rico
  @restriction_puerto_rico
end

#restriction_us_territoriesObject

US Territories restriction



53
54
55
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 53

def restriction_us_territories
  @restriction_us_territories
end

#themesObject

Returns the value of attribute themes.



55
56
57
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 55

def themes
  @themes
end

Class Method Details

.attribute_mapObject

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



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 80

def self.attribute_map
  {
    :'descriptions' => :'descriptions',
    :'maximum_subtotal' => :'maximum_subtotal',
    :'minimum_subtotal' => :'minimum_subtotal',
    :'payment_method' => :'payment_method',
    :'restriction_alaska_hawaii' => :'restriction_alaska_hawaii',
    :'restriction_apo_fpo' => :'restriction_apo_fpo',
    :'restriction_canada' => :'restriction_canada',
    :'restriction_continental_us' => :'restriction_continental_us',
    :'restriction_domestic_only' => :'restriction_domestic_only',
    :'restriction_international_only' => :'restriction_international_only',
    :'restriction_po_box' => :'restriction_po_box',
    :'restriction_puerto_rico' => :'restriction_puerto_rico',
    :'restriction_us_territories' => :'restriction_us_territories',
    :'themes' => :'themes'
  }
end

.swagger_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 100

def self.swagger_types
  {
    :'descriptions' => :'Array<String>',
    :'maximum_subtotal' => :'Float',
    :'minimum_subtotal' => :'Float',
    :'payment_method' => :'String',
    :'restriction_alaska_hawaii' => :'String',
    :'restriction_apo_fpo' => :'String',
    :'restriction_canada' => :'String',
    :'restriction_continental_us' => :'String',
    :'restriction_domestic_only' => :'String',
    :'restriction_international_only' => :'String',
    :'restriction_po_box' => :'String',
    :'restriction_puerto_rico' => :'String',
    :'restriction_us_territories' => :'String',
    :'themes' => :'Array<PaymentsConfigurationRestrictionsTheme>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 311

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      descriptions == o.descriptions &&
      maximum_subtotal == o.maximum_subtotal &&
      minimum_subtotal == o.minimum_subtotal &&
      payment_method == o.payment_method &&
      restriction_alaska_hawaii == o.restriction_alaska_hawaii &&
      restriction_apo_fpo == o.restriction_apo_fpo &&
      restriction_canada == o.restriction_canada &&
      restriction_continental_us == o.restriction_continental_us &&
      restriction_domestic_only == o.restriction_domestic_only &&
      restriction_international_only == o.restriction_international_only &&
      restriction_po_box == o.restriction_po_box &&
      restriction_puerto_rico == o.restriction_puerto_rico &&
      restriction_us_territories == o.restriction_us_territories &&
      themes == o.themes
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



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 366

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 = UltracartClient.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



432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 432

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



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 345

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


332
333
334
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 332

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



338
339
340
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 338

def hash
  [descriptions, maximum_subtotal, minimum_subtotal, payment_method, restriction_alaska_hawaii, restriction_apo_fpo, restriction_canada, restriction_continental_us, restriction_domestic_only, restriction_international_only, restriction_po_box, restriction_puerto_rico, restriction_us_territories, themes].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



190
191
192
193
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 190

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



412
413
414
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 412

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



418
419
420
421
422
423
424
425
426
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 418

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



406
407
408
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 406

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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ultracart_api/models/payments_configuration_restrictions.rb', line 197

def valid?
  restriction_alaska_hawaii_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_alaska_hawaii_validator.valid?(@restriction_alaska_hawaii)
  restriction_apo_fpo_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_apo_fpo_validator.valid?(@restriction_apo_fpo)
  restriction_canada_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_canada_validator.valid?(@restriction_canada)
  restriction_continental_us_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_continental_us_validator.valid?(@restriction_continental_us)
  restriction_domestic_only_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_domestic_only_validator.valid?(@restriction_domestic_only)
  restriction_international_only_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_international_only_validator.valid?(@restriction_international_only)
  restriction_po_box_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_po_box_validator.valid?(@restriction_po_box)
  restriction_puerto_rico_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_puerto_rico_validator.valid?(@restriction_puerto_rico)
  restriction_us_territories_validator = EnumAttributeValidator.new('String', ['invalid', 'invalidOnly', 'valid'])
  return false unless restriction_us_territories_validator.valid?(@restriction_us_territories)
  true
end