Class: ShellCardManagementApIs::ShellSiteRestriction

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

Overview

ShellSiteRestriction 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, sites = SKIP, site_groups = SKIP, exclusive = SKIP) ⇒ ShellSiteRestriction

Returns a new instance of ShellSiteRestriction.



63
64
65
66
67
68
69
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 63

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

Instance Attribute Details

#countryString

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

Returns:

  • (String)


16
17
18
# File 'lib/shell_card_management_ap_is/models/shell_site_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 “Sites” & “SiteGroups” properties lists the sites & site groups where the transaction will be allowed. True - (exclusive), i.e. the “Sites” & “SiteGroups” properties lists the sites and site groups where the transactions will be declined.

Returns:

  • (TrueClass | FalseClass)


36
37
38
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 36

def exclusive
  @exclusive
end

#site_groupsArray[String]

A list of site group ids in this country which is either restricted or allowed.

Returns:

  • (Array[String])


28
29
30
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 28

def site_groups
  @site_groups
end

#sitesArray[String]

A list of Site IDs in this country, in the format “AA1111” where “AA” is a 2-character country code and “1111” is a 4-digit site number in that country, which is either restricted or allowed. For example, “GB1234”.

Returns:

  • (Array[String])


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

def sites
  @sites
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  country = hash.key?('Country') ? hash['Country'] : SKIP
  sites = hash.key?('Sites') ? hash['Sites'] : SKIP
  site_groups = hash.key?('SiteGroups') ? hash['SiteGroups'] : SKIP
  exclusive = hash.key?('Exclusive') ? hash['Exclusive'] : SKIP

  # Create object from extracted values.
  ShellSiteRestriction.new(country,
                           sites,
                           site_groups,
                           exclusive)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['country'] = 'Country'
  @_hash['sites'] = 'Sites'
  @_hash['site_groups'] = 'SiteGroups'
  @_hash['exclusive'] = 'Exclusive'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
# File 'lib/shell_card_management_ap_is/models/shell_site_restriction.rb', line 49

def self.optionals
  %w[
    country
    sites
    site_groups
    exclusive
  ]
end