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



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

#aliasesString

Returns A different name for a country.

Returns:

  • (String)

    A different name for a country



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

def aliases
  @aliases
end

#alpha2String

Returns 2 letter alphabetic code for the given country.

Returns:

  • (String)

    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

#alpha3String

Returns 3 letter alphabetic code for the given country.

Returns:

  • (String)

    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_codeInt32

Returns Unique 3 digit number for the given country.

Returns:

  • (Int32)

    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_nameString

Returns French name of the country.

Returns:

  • (String)

    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_regionString

Returns Intermediate region of the country.

Returns:

  • (String)

    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_codeInt32

Returns Numeric code for an intermediate region.

Returns:

  • (Int32)

    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

#nameString

Returns Name of the country.

Returns:

  • (String)

    Name of the country



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

def name
  @name
end

#regionString

Returns Region of the country.

Returns:

  • (String)

    Region of the country



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

def region
  @region
end

#region_codeInt32

Returns Numeric code for a region.

Returns:

  • (Int32)

    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_regionString

Returns Subregion of the country.

Returns:

  • (String)

    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_codeInt32

Returns Numeric code for a subregion.

Returns:

  • (Int32)

    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.

Returns:

  • (object)

    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(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



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

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