Class: Access::Geolocation
- Inherits:
-
Object
- Object
- Access::Geolocation
- Defined in:
- lib/access/geolocation.rb
Instance Attribute Summary collapse
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(values) ⇒ Geolocation
constructor
A new instance of Geolocation.
Constructor Details
#initialize(values) ⇒ Geolocation
17 18 19 20 21 22 23 24 25 |
# File 'lib/access/geolocation.rb', line 17 def initialize(values) self.class.class_eval {attr_reader *values.keys } values.each do |attribute_name, attribute_value| self.instance_variable_set("@#{attribute_name}", attribute_value) end @lat = @geolocation['lat'] @lon = @geolocation['lon'] end |
Instance Attribute Details
#lat ⇒ Object
Returns the value of attribute lat.
3 4 5 |
# File 'lib/access/geolocation.rb', line 3 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
3 4 5 |
# File 'lib/access/geolocation.rb', line 3 def lon @lon end |
Class Method Details
.find(options = {}) ⇒ Object
9 10 11 |
# File 'lib/access/geolocation.rb', line 9 def self.find( = {}) Access::Api.new.geolocation_find end |
.process_batch(chunk) ⇒ Object
13 14 15 |
# File 'lib/access/geolocation.rb', line 13 def self.process_batch(chunk) chunk.map { |location| new(location) } end |
.search(options = {}) ⇒ Object
5 6 7 |
# File 'lib/access/geolocation.rb', line 5 def self.search( = {}) Access::Api.new.geolocation_search end |