Class: Verizon::Region

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/region.rb

Overview

Information representing a certain geographical or logical area where MEC resources and services are provided.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(region_id = SKIP, name = SKIP, country_code = SKIP, metro = SKIP, area = SKIP) ⇒ Region

Returns a new instance of Region.



69
70
71
72
73
74
75
76
# File 'lib/verizon/models/region.rb', line 69

def initialize(region_id = SKIP, name = SKIP, country_code = SKIP,
               metro = SKIP, area = SKIP)
  @region_id = region_id unless region_id == SKIP
  @name = name unless name == SKIP
  @country_code = country_code unless country_code == SKIP
  @metro = metro unless metro == SKIP
  @area = area unless area == SKIP
end

Instance Attribute Details

#areaString

This is a sub-set of ‘City’ and is similar to ‘Zone’. This is future functionality, so the value returned is ‘null’.

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/region.rb', line 34

def area
  @area
end

#country_codeString

A two-character alpha code for a country, based on ISO 3166-1 alpha-2. This is future functionality, so the value returned is ‘null’.

Returns:

  • (String)


24
25
26
# File 'lib/verizon/models/region.rb', line 24

def country_code
  @country_code
end

#metroString

The metropolitan area or ‘City’ value. This is future functionality, so the value returned is ‘null’.

Returns:

  • (String)


29
30
31
# File 'lib/verizon/models/region.rb', line 29

def metro
  @metro
end

#nameString

A relevant and identifiable region name.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/region.rb', line 19

def name
  @name
end

#region_idString

The unique identifier of the region.

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/region.rb', line 15

def region_id
  @region_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/verizon/models/region.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  region_id = hash.key?('regionId') ? hash['regionId'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  country_code = hash.key?('countryCode') ? hash['countryCode'] : SKIP
  metro = hash.key?('metro') ? hash['metro'] : SKIP
  area = hash.key?('area') ? hash['area'] : SKIP

  # Create object from extracted values.
  Region.new(region_id,
             name,
             country_code,
             metro,
             area)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
# File 'lib/verizon/models/region.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['region_id'] = 'regionId'
  @_hash['name'] = 'name'
  @_hash['country_code'] = 'countryCode'
  @_hash['metro'] = 'metro'
  @_hash['area'] = 'area'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
62
63
64
65
66
67
# File 'lib/verizon/models/region.rb', line 59

def self.nullables
  %w[
    region_id
    name
    country_code
    metro
    area
  ]
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
56
# File 'lib/verizon/models/region.rb', line 48

def self.optionals
  %w[
    region_id
    name
    country_code
    metro
    area
  ]
end