Class: ShellDataReportingApIs::SiteLocation

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

Overview

Geography Location entity for Site Location

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(latitude = SKIP, longitude = SKIP) ⇒ SiteLocation

Returns a new instance of SiteLocation.



48
49
50
51
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 48

def initialize(latitude = SKIP, longitude = SKIP)
  @latitude = latitude unless latitude == SKIP
  @longitude = longitude unless longitude == SKIP
end

Instance Attribute Details

#latitudeString

Latitude for the Site Geographic Location Example: 37.4224764 Note: - The value could be null/blank for fees item.

Returns:

  • (String)


16
17
18
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 16

def latitude
  @latitude
end

#longitudeString

Longitude for the Site Geographic Location Example: 122.0842499 Note: - The value could be null/blank for fees item.

Returns:

  • (String)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 22

def longitude
  @longitude
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  latitude = hash.key?('Latitude') ? hash['Latitude'] : SKIP
  longitude = hash.key?('Longitude') ? hash['Longitude'] : SKIP

  # Create object from extracted values.
  SiteLocation.new(latitude,
                   longitude)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['latitude'] = 'Latitude'
  @_hash['longitude'] = 'Longitude'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
44
45
46
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 41

def self.nullables
  %w[
    latitude
    longitude
  ]
end

.optionalsObject

An array for optional fields



33
34
35
36
37
38
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 33

def self.optionals
  %w[
    latitude
    longitude
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (SiteLocation | Hash)

    value against the validation is performed.



68
69
70
71
72
73
74
# File 'lib/shell_data_reporting_ap_is/models/site_location.rb', line 68

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end