Class: LockstepSdk::CountryModel

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/models/country_model.rb

Overview

Country model for ISO-3166

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CountryModel

Initialize the CountryModel using the provided prototype



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/lockstep_sdk/models/country_model.rb', line 27

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

#aliasesString

Returns A different name for a country.

Returns:

  • (String)

    A different name for a country



88
89
90
# File 'lib/lockstep_sdk/models/country_model.rb', line 88

def aliases
  @aliases
end

#alpha2String

Returns 2 letter alphabetic code for the given country.

Returns:

  • (String)

    2 letter alphabetic code for the given country



48
49
50
# File 'lib/lockstep_sdk/models/country_model.rb', line 48

def alpha2
  @alpha2
end

#alpha3String

Returns 3 letter alphabetic code for the given country.

Returns:

  • (String)

    3 letter alphabetic code for the given country



52
53
54
# File 'lib/lockstep_sdk/models/country_model.rb', line 52

def alpha3
  @alpha3
end

#country_codeInt32

Returns Unique 3 digit number for the given country.

Returns:

  • (Int32)

    Unique 3 digit number for the given country



56
57
58
# File 'lib/lockstep_sdk/models/country_model.rb', line 56

def country_code
  @country_code
end

#french_nameString

Returns French name of the country.

Returns:

  • (String)

    French name of the country



84
85
86
# File 'lib/lockstep_sdk/models/country_model.rb', line 84

def french_name
  @french_name
end

#intermediate_regionString

Returns Intermediate region of the country.

Returns:

  • (String)

    Intermediate region of the country



68
69
70
# File 'lib/lockstep_sdk/models/country_model.rb', line 68

def intermediate_region
  @intermediate_region
end

#intermediate_region_codeInt32

Returns Numeric code for an intermediate region.

Returns:

  • (Int32)

    Numeric code for an intermediate region



80
81
82
# File 'lib/lockstep_sdk/models/country_model.rb', line 80

def intermediate_region_code
  @intermediate_region_code
end

#nameString

Returns Name of the country.

Returns:

  • (String)

    Name of the country



44
45
46
# File 'lib/lockstep_sdk/models/country_model.rb', line 44

def name
  @name
end

#regionString

Returns Region of the country.

Returns:

  • (String)

    Region of the country



60
61
62
# File 'lib/lockstep_sdk/models/country_model.rb', line 60

def region
  @region
end

#region_codeInt32

Returns Numeric code for a region.

Returns:

  • (Int32)

    Numeric code for a region



72
73
74
# File 'lib/lockstep_sdk/models/country_model.rb', line 72

def region_code
  @region_code
end

#sub_regionString

Returns Subregion of the country.

Returns:

  • (String)

    Subregion of the country



64
65
66
# File 'lib/lockstep_sdk/models/country_model.rb', line 64

def sub_region
  @sub_region
end

#sub_region_codeInt32

Returns Numeric code for a subregion.

Returns:

  • (Int32)

    Numeric code for a subregion



76
77
78
# File 'lib/lockstep_sdk/models/country_model.rb', line 76

def sub_region_code
  @sub_region_code
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/lockstep_sdk/models/country_model.rb', line 92

def as_json(options={})
    {
        '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.

Returns:

  • (String)

    This object converted to a JSON string



111
112
113
# File 'lib/lockstep_sdk/models/country_model.rb', line 111

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end