Class: ShellSmartPayApi::Loc
- Defined in:
- lib/shell_smart_pay_api/models/loc.rb
Overview
Object containing address details/elements
Instance Attribute Summary collapse
-
#ccode ⇒ String
The two-letter ISO 3166 country code of the country the station is located within.
-
#city ⇒ String
The city the station is located within.
-
#country ⇒ String
The name of the country (in English) the station is located within.
-
#pc ⇒ String
The station’s postcode.
-
#region ⇒ String
The region the station is located within.
-
#street ⇒ String
The station’s full street address, including building number.
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 = nil, ccode = nil, street = SKIP, pc = SKIP, city = SKIP, region = SKIP) ⇒ Loc
constructor
A new instance of Loc.
-
#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 = nil, ccode = nil, street = SKIP, pc = SKIP, city = SKIP, region = SKIP) ⇒ Loc
Returns a new instance of Loc.
64 65 66 67 68 69 70 71 72 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 64 def initialize(country = nil, ccode = nil, street = SKIP, pc = SKIP, city = SKIP, region = SKIP) @street = street unless street == SKIP @pc = pc unless pc == SKIP @city = city unless city == SKIP @region = region unless region == SKIP @country = country @ccode = ccode end |
Instance Attribute Details
#ccode ⇒ String
The two-letter ISO 3166 country code of the country the station is located within
35 36 37 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 35 def ccode @ccode end |
#city ⇒ String
The city the station is located within
22 23 24 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 22 def city @city end |
#country ⇒ String
The name of the country (in English) the station is located within
30 31 32 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 30 def country @country end |
#pc ⇒ String
The station’s postcode
18 19 20 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 18 def pc @pc end |
#region ⇒ String
The region the station is located within
26 27 28 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 26 def region @region end |
#street ⇒ String
The station’s full street address, including building number
14 15 16 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 14 def street @street end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country = hash.key?('country') ? hash['country'] : nil ccode = hash.key?('ccode') ? hash['ccode'] : nil street = hash.key?('street') ? hash['street'] : SKIP pc = hash.key?('pc') ? hash['pc'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP # Create object from extracted values. Loc.new(country, ccode, street, pc, city, region) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['street'] = 'street' @_hash['pc'] = 'pc' @_hash['city'] = 'city' @_hash['region'] = 'region' @_hash['country'] = 'country' @_hash['ccode'] = 'ccode' @_hash end |
.nullables ⇒ Object
An array for nullable fields
60 61 62 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 60 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 50 def self.optionals %w[ street pc city region ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
103 104 105 106 107 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 103 def inspect class_name = self.class.name.split('::').last "<#{class_name} street: #{@street.inspect}, pc: #{@pc.inspect}, city: #{@city.inspect},"\ " region: #{@region.inspect}, country: #{@country.inspect}, ccode: #{@ccode.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 |
# File 'lib/shell_smart_pay_api/models/loc.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} street: #{@street}, pc: #{@pc}, city: #{@city}, region: #{@region},"\ " country: #{@country}, ccode: #{@ccode}>" end |