Class: ShellCardManagementApIs::LocationRestriction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::LocationRestriction
- Defined in:
- lib/shell_card_management_ap_is/models/location_restriction.rb
Overview
LocationRestriction Model.
Instance Attribute Summary collapse
-
#country_restrictions ⇒ CountryRestriction
TODO: Write general description for this method.
-
#network_restrictions ⇒ Array[NetworkRestriction]
TODO: Write general description for this method.
-
#partner_site_restrictions ⇒ Array[PartnerSiteRestriction]
TODO: Write general description for this method.
-
#shell_site_restrictions ⇒ Array[ShellSiteRestriction]
TODO: Write general description for this method.
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(country_restrictions = SKIP, network_restrictions = SKIP, shell_site_restrictions = SKIP, partner_site_restrictions = SKIP) ⇒ LocationRestriction
constructor
A new instance of LocationRestriction.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(country_restrictions = SKIP, network_restrictions = SKIP, shell_site_restrictions = SKIP, partner_site_restrictions = SKIP) ⇒ LocationRestriction
Returns a new instance of LocationRestriction.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 53 def initialize(country_restrictions = SKIP, network_restrictions = SKIP, shell_site_restrictions = SKIP, partner_site_restrictions = SKIP) @country_restrictions = country_restrictions unless country_restrictions == SKIP @network_restrictions = network_restrictions unless network_restrictions == SKIP @shell_site_restrictions = shell_site_restrictions unless shell_site_restrictions == SKIP unless partner_site_restrictions == SKIP @partner_site_restrictions = partner_site_restrictions end end |
Instance Attribute Details
#country_restrictions ⇒ CountryRestriction
TODO: Write general description for this method
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 14 def country_restrictions @country_restrictions end |
#network_restrictions ⇒ Array[NetworkRestriction]
TODO: Write general description for this method
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 18 def network_restrictions @network_restrictions end |
#partner_site_restrictions ⇒ Array[PartnerSiteRestriction]
TODO: Write general description for this method
26 27 28 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 26 def partner_site_restrictions @partner_site_restrictions end |
#shell_site_restrictions ⇒ Array[ShellSiteRestriction]
TODO: Write general description for this method
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 22 def shell_site_restrictions @shell_site_restrictions end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_restrictions = CountryRestriction.from_hash(hash['CountryRestrictions']) if hash['CountryRestrictions'] # Parameter is an array, so we need to iterate through it network_restrictions = nil unless hash['NetworkRestrictions'].nil? network_restrictions = [] hash['NetworkRestrictions'].each do |structure| network_restrictions << (NetworkRestriction.from_hash(structure) if structure) end end network_restrictions = SKIP unless hash.key?('NetworkRestrictions') # Parameter is an array, so we need to iterate through it shell_site_restrictions = nil unless hash['ShellSiteRestrictions'].nil? shell_site_restrictions = [] hash['ShellSiteRestrictions'].each do |structure| shell_site_restrictions << (ShellSiteRestriction.from_hash(structure) if structure) end end shell_site_restrictions = SKIP unless hash.key?('ShellSiteRestrictions') # Parameter is an array, so we need to iterate through it partner_site_restrictions = nil unless hash['PartnerSiteRestrictions'].nil? partner_site_restrictions = [] hash['PartnerSiteRestrictions'].each do |structure| partner_site_restrictions << (PartnerSiteRestriction.from_hash(structure) if structure) end end partner_site_restrictions = SKIP unless hash.key?('PartnerSiteRestrictions') # Create object from extracted values. LocationRestriction.new(country_restrictions, network_restrictions, shell_site_restrictions, partner_site_restrictions) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['country_restrictions'] = 'CountryRestrictions' @_hash['network_restrictions'] = 'NetworkRestrictions' @_hash['shell_site_restrictions'] = 'ShellSiteRestrictions' @_hash['partner_site_restrictions'] = 'PartnerSiteRestrictions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 39 def self.optionals %w[ country_restrictions network_restrictions shell_site_restrictions partner_site_restrictions ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 125 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} country_restrictions: #{@country_restrictions.inspect},"\ " network_restrictions: #{@network_restrictions.inspect}, shell_site_restrictions:"\ " #{@shell_site_restrictions.inspect}, partner_site_restrictions:"\ " #{@partner_site_restrictions.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 116 |
# File 'lib/shell_card_management_ap_is/models/location_restriction.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} country_restrictions: #{@country_restrictions}, network_restrictions:"\ " #{@network_restrictions}, shell_site_restrictions: #{@shell_site_restrictions},"\ " partner_site_restrictions: #{@partner_site_restrictions}>" end |