Class: ShellCardManagementApIs::NetworkRestriction

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

Overview

NetworkRestriction Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(country = SKIP, networks = SKIP, exclusive = SKIP) ⇒ NetworkRestriction

Returns a new instance of NetworkRestriction.



54
55
56
57
58
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 54

def initialize(country = SKIP, networks = SKIP, exclusive = SKIP)
  @country = country unless country == SKIP
  @networks = networks unless networks == SKIP
  @exclusive = exclusive unless exclusive == SKIP
end

Instance Attribute Details

#countryString

ISO 3166-1 Numeric-3 code of the country where the network restriction is applied. Example: 826 for United Kingdom.

Returns:

  • (String)


16
17
18
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 16

def country
  @country
end

#exclusiveTrueClass | FalseClass

Flag indicates whether the profile is inclusive or exclusive. Example: False - (inclusive), i.e. the “Networks” property lists the networks in which the transaction will be allowed. True - (exclusive), i.e. the “Networks” property lists the networks in which the transactions will be declined.

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 29

def exclusive
  @exclusive
end

#networksArray[String]

A list of Gateway network codes, typically 7 or 10 digits. Example: 0002003250

Returns:

  • (Array[String])


21
22
23
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 21

def networks
  @networks
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  country = hash.key?('Country') ? hash['Country'] : SKIP
  networks = hash.key?('Networks') ? hash['Networks'] : SKIP
  exclusive = hash.key?('Exclusive') ? hash['Exclusive'] : SKIP

  # Create object from extracted values.
  NetworkRestriction.new(country,
                         networks,
                         exclusive)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['country'] = 'Country'
  @_hash['networks'] = 'Networks'
  @_hash['exclusive'] = 'Exclusive'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
# File 'lib/shell_card_management_ap_is/models/network_restriction.rb', line 41

def self.optionals
  %w[
    country
    networks
    exclusive
  ]
end