Class: ShellDataReportingApIs::Location

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/location.rb

Overview

Location Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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

#latString

Latitude for the Site Geographic Location

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/location.rb', line 14

def lat
  @lat
end

#lngString

Longitude for the Site Geographic Location

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

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

.optionalsObject

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