Class: LockstepSdk::CountryModel
- Inherits:
-
Object
- Object
- LockstepSdk::CountryModel
- Defined in:
- lib/lockstep_sdk/models/country_model.rb
Overview
Country model for ISO-3166
Instance Attribute Summary collapse
-
#aliases ⇒ String
A different name for a country.
-
#alpha2 ⇒ String
2 letter alphabetic code for the given country.
-
#alpha3 ⇒ String
3 letter alphabetic code for the given country.
-
#country_code ⇒ Int32
Unique 3 digit number for the given country.
-
#french_name ⇒ String
French name of the country.
-
#intermediate_region ⇒ String
Intermediate region of the country.
-
#intermediate_region_code ⇒ Int32
Numeric code for an intermediate region.
-
#name ⇒ String
Name of the country.
-
#region ⇒ String
Region of the country.
-
#region_code ⇒ Int32
Numeric code for a region.
-
#sub_region ⇒ String
Subregion of the country.
-
#sub_region_code ⇒ Int32
Numeric code for a subregion.
Instance Method Summary collapse
-
#as_json(options = {}) ⇒ object
This object as a JSON key-value structure.
-
#initialize(params = {}) ⇒ CountryModel
constructor
Initialize the CountryModel using the provided prototype.
-
#to_json(*options) ⇒ String
This object converted to a JSON string.
Constructor Details
#initialize(params = {}) ⇒ CountryModel
Initialize the CountryModel using the provided prototype
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 26 def initialize(params = {}) @name = params.dig(:name) @alpha2 = params.dig(:alpha2) @alpha3 = params.dig(:alpha3) @country_code = params.dig(:country_code) @region = params.dig(:region) @sub_region = params.dig(:sub_region) @intermediate_region = params.dig(:intermediate_region) @region_code = params.dig(:region_code) @sub_region_code = params.dig(:sub_region_code) @intermediate_region_code = params.dig(:intermediate_region_code) @french_name = params.dig(:french_name) @aliases = params.dig(:aliases) end |
Instance Attribute Details
#aliases ⇒ String
Returns A different name for a country.
64 65 66 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 64 def aliases @aliases end |
#alpha2 ⇒ String
Returns 2 letter alphabetic code for the given country.
44 45 46 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 44 def alpha2 @alpha2 end |
#alpha3 ⇒ String
Returns 3 letter alphabetic code for the given country.
46 47 48 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 46 def alpha3 @alpha3 end |
#country_code ⇒ Int32
Returns Unique 3 digit number for the given country.
48 49 50 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 48 def country_code @country_code end |
#french_name ⇒ String
Returns French name of the country.
62 63 64 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 62 def french_name @french_name end |
#intermediate_region ⇒ String
Returns Intermediate region of the country.
54 55 56 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 54 def intermediate_region @intermediate_region end |
#intermediate_region_code ⇒ Int32
Returns Numeric code for an intermediate region.
60 61 62 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 60 def intermediate_region_code @intermediate_region_code end |
#name ⇒ String
Returns Name of the country.
42 43 44 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 42 def name @name end |
#region ⇒ String
Returns Region of the country.
50 51 52 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 50 def region @region end |
#region_code ⇒ Int32
Returns Numeric code for a region.
56 57 58 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 56 def region_code @region_code end |
#sub_region ⇒ String
Returns Subregion of the country.
52 53 54 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 52 def sub_region @sub_region end |
#sub_region_code ⇒ Int32
Returns Numeric code for a subregion.
58 59 60 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 58 def sub_region_code @sub_region_code end |
Instance Method Details
#as_json(options = {}) ⇒ object
Returns This object as a JSON key-value structure.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 67 def as_json(={}) { 'name' => @name, 'alpha2' => @alpha2, 'alpha3' => @alpha3, 'countryCode' => @country_code, 'region' => @region, 'subRegion' => @sub_region, 'intermediateRegion' => @intermediate_region, 'regionCode' => @region_code, 'subRegionCode' => @sub_region_code, 'intermediateRegionCode' => @intermediate_region_code, 'frenchName' => @french_name, 'aliases' => @aliases, } end |
#to_json(*options) ⇒ String
Returns This object converted to a JSON string.
85 86 87 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 85 def to_json(*) "[#{as_json(*).to_json(*)}]" end |