Class: ShellCardManagementApIs::CountryRestriction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/models/country_restriction.rb

Overview

CountryRestriction Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(countries = SKIP, exclusive = SKIP) ⇒ CountryRestriction

Returns a new instance of CountryRestriction.



46
47
48
49
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 46

def initialize(countries = SKIP, exclusive = SKIP)
  @countries = countries unless countries == SKIP
  @exclusive = exclusive unless exclusive == SKIP
end

Instance Attribute Details

#countriesArray[String]

A list of ISO 3166-1 Numeric-3 country codes. Example: 826 for United Kingdom.

Returns:

  • (Array[String])


15
16
17
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 15

def countries
  @countries
end

#exclusiveTrueClass | FalseClass

Flag indicates whether the profile is inclusive or exclusive. Example: False - (inclusive), i.e. the “Countries” property lists the countries where the transactions will be allowed. True - (exclusive), i.e. the “Countries” property lists the countries where the transactions will be declined.

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 23

def exclusive
  @exclusive
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  countries = hash.key?('Countries') ? hash['Countries'] : SKIP
  exclusive = hash.key?('Exclusive') ? hash['Exclusive'] : SKIP

  # Create object from extracted values.
  CountryRestriction.new(countries,
                         exclusive)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['countries'] = 'Countries'
  @_hash['exclusive'] = 'Exclusive'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 34

def self.optionals
  %w[
    countries
    exclusive
  ]
end