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
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 28 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.
89 90 91 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 89 def aliases @aliases end |
#alpha2 ⇒ String
Returns 2 letter alphabetic code for the given country.
49 50 51 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 49 def alpha2 @alpha2 end |
#alpha3 ⇒ String
Returns 3 letter alphabetic code for the given country.
53 54 55 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 53 def alpha3 @alpha3 end |
#country_code ⇒ Int32
Returns Unique 3 digit number for the given country.
57 58 59 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 57 def country_code @country_code end |
#french_name ⇒ String
Returns French name of the country.
85 86 87 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 85 def french_name @french_name end |
#intermediate_region ⇒ String
Returns Intermediate region of the country.
69 70 71 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 69 def intermediate_region @intermediate_region end |
#intermediate_region_code ⇒ Int32
Returns Numeric code for an intermediate region.
81 82 83 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 81 def intermediate_region_code @intermediate_region_code end |
#name ⇒ String
Returns Name of the country.
45 46 47 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 45 def name @name end |
#region ⇒ String
Returns Region of the country.
61 62 63 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 61 def region @region end |
#region_code ⇒ Int32
Returns Numeric code for a region.
73 74 75 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 73 def region_code @region_code end |
#sub_region ⇒ String
Returns Subregion of the country.
65 66 67 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 65 def sub_region @sub_region end |
#sub_region_code ⇒ Int32
Returns Numeric code for a subregion.
77 78 79 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 77 def sub_region_code @sub_region_code end |
Instance Method Details
#as_json(options = {}) ⇒ object
Returns This object as a JSON key-value structure.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 93 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.
112 113 114 |
# File 'lib/lockstep_sdk/models/country_model.rb', line 112 def to_json(*) "[#{as_json(*).to_json(*)}]" end |