Class: Parse::GeoPoint

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/parse/geo_point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

#string_keyed_hash

Constructor Details

#initialize(hash = {}) ⇒ GeoPoint

Returns a new instance of GeoPoint.



8
9
10
11
12
# File 'lib/parse/geo_point.rb', line 8

def initialize hash={}
  hash = string_keyed_hash hash
  @latitude = hash['latitude']
  @longitude = hash['longitude']
end

Instance Attribute Details

#latitudeObject

Returns the value of attribute latitude.



6
7
8
# File 'lib/parse/geo_point.rb', line 6

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude.



6
7
8
# File 'lib/parse/geo_point.rb', line 6

def longitude
  @longitude
end

Instance Method Details

#to_hObject



14
15
16
17
18
19
20
# File 'lib/parse/geo_point.rb', line 14

def to_h
  {
    "__type" => "GeoPoint",
    "latitude" => @latitude,
    "longitude" => @longitude
  }
end

#to_json(*args) ⇒ Object



22
23
24
# File 'lib/parse/geo_point.rb', line 22

def to_json *args
  to_h.to_json
end