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



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

#aliasesString

Returns A different name for a country.

Returns:

  • (String)

    A different name for a country



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

def aliases
  @aliases
end

#alpha2String

Returns 2 letter alphabetic code for the given country.

Returns:

  • (String)

    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

#alpha3String

Returns 3 letter alphabetic code for the given country.

Returns:

  • (String)

    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_codeInt32

Returns Unique 3 digit number for the given country.

Returns:

  • (Int32)

    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_nameString

Returns French name of the country.

Returns:

  • (String)

    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_regionString

Returns Intermediate region of the country.

Returns:

  • (String)

    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_codeInt32

Returns Numeric code for an intermediate region.

Returns:

  • (Int32)

    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

#nameString

Returns Name of the country.

Returns:

  • (String)

    Name of the country



42
43
44
# File 'lib/lockstep_sdk/models/country_model.rb', line 42

def name
  @name
end

#regionString

Returns Region of the country.

Returns:

  • (String)

    Region of the country



50
51
52
# File 'lib/lockstep_sdk/models/country_model.rb', line 50

def region
  @region
end

#region_codeInt32

Returns Numeric code for a region.

Returns:

  • (Int32)

    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_regionString

Returns Subregion of the country.

Returns:

  • (String)

    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_codeInt32

Returns Numeric code for a subregion.

Returns:

  • (Int32)

    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.

Returns:

  • (object)

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



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

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