Class: ShellDataReportingApIs::Location
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellDataReportingApIs::Location
- Defined in:
- lib/shell_data_reporting_ap_is/models/location.rb
Overview
Location Model.
Instance Attribute Summary collapse
-
#lat ⇒ String
Latitude for the Site Geographic Location.
-
#lng ⇒ String
Longitude for the Site Geographic Location.
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(lat = SKIP, lng = SKIP) ⇒ Location
constructor
A new instance of Location.
Methods inherited from BaseModel
Constructor Details
#initialize(lat = SKIP, lng = SKIP) ⇒ Location
Returns a new instance of Location.
44 45 46 47 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 44 def initialize(lat = SKIP, lng = SKIP) @lat = lat unless lat == SKIP @lng = lng unless lng == SKIP end |
Instance Attribute Details
#lat ⇒ String
Latitude for the Site Geographic Location
14 15 16 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 14 def lat @lat end |
#lng ⇒ String
Longitude for the Site Geographic Location
18 19 20 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 18 def lng @lng end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. lat = hash.key?('Lat') ? hash['Lat'] : SKIP lng = hash.key?('Lng') ? hash['Lng'] : SKIP # Create object from extracted values. Location.new(lat, lng) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['lat'] = 'Lat' @_hash['lng'] = 'Lng' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 40 41 42 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 37 def self.nullables %w[ lat lng ] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 32 33 34 |
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 29 def self.optionals %w[ lat lng ] end |