Class: ShellCardManagementApIs::CountryRestriction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::CountryRestriction
- Defined in:
- lib/shell_card_management_ap_is/models/country_restriction.rb
Overview
CountryRestriction Model.
Instance Attribute Summary collapse
-
#countries ⇒ Array[String]
A list of ISO 3166-1 Numeric-3 country codes.
-
#exclusive ⇒ TrueClass | FalseClass
Flag indicates whether the profile is inclusive or exclusive.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(countries = SKIP, exclusive = SKIP) ⇒ CountryRestriction
constructor
A new instance of CountryRestriction.
Methods inherited from BaseModel
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
#countries ⇒ Array[String]
A list of ISO 3166-1 Numeric-3 country codes. Example: 826 for United Kingdom.
15 16 17 |
# File 'lib/shell_card_management_ap_is/models/country_restriction.rb', line 15 def countries @countries end |
#exclusive ⇒ TrueClass | 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.
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
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 |
.optionals ⇒ Object
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 |