Class: Verizon::Region
- 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
-
#area ⇒ String
This is a sub-set of ‘City’ and is similar to ‘Zone’.
-
#country_code ⇒ String
A two-character alpha code for a country, based on ISO 3166-1 alpha-2.
-
#metro ⇒ String
The metropolitan area or ‘City’ value.
-
#name ⇒ String
A relevant and identifiable region name.
-
#region_id ⇒ String
The unique identifier of the region.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(region_id: SKIP, name: SKIP, country_code: SKIP, metro: SKIP, area: SKIP) ⇒ Region
constructor
A new instance of Region.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #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
#area ⇒ String
This is a sub-set of ‘City’ and is similar to ‘Zone’. This is future functionality, so the value returned is ‘null’.
34 35 36 |
# File 'lib/verizon/models/region.rb', line 34 def area @area end |
#country_code ⇒ String
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’.
24 25 26 |
# File 'lib/verizon/models/region.rb', line 24 def country_code @country_code end |
#metro ⇒ String
The metropolitan area or ‘City’ value. This is future functionality, so the value returned is ‘null’.
29 30 31 |
# File 'lib/verizon/models/region.rb', line 29 def metro @metro end |
#name ⇒ String
A relevant and identifiable region name.
19 20 21 |
# File 'lib/verizon/models/region.rb', line 19 def name @name end |
#region_id ⇒ String
The unique identifier of the region.
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: region_id, name: name, country_code: country_code, metro: metro, area: area) end |
.names ⇒ Object
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 |
.nullables ⇒ Object
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 |
.optionals ⇒ Object
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 |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 |
# File 'lib/verizon/models/region.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} region_id: #{@region_id.inspect}, name: #{@name.inspect}, country_code:"\ " #{@country_code.inspect}, metro: #{@metro.inspect}, area: #{@area.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 |
# File 'lib/verizon/models/region.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} region_id: #{@region_id}, name: #{@name}, country_code: #{@country_code},"\ " metro: #{@metro}, area: #{@area}>" end |