Class: GeoAPI::Entity
- Inherits:
-
Object
- Object
- GeoAPI::Entity
- Defined in:
- lib/geoapi/entity.rb
Instance Attribute Summary collapse
-
#geom ⇒ Object
readonly
Returns the value of attribute geom.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#latitude ⇒ Object
(also: #lat)
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
(also: #lon)
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw_json ⇒ Object
readonly
Returns the value of attribute raw_json.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#userviews ⇒ Object
readonly
Returns the value of attribute userviews.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Entity
constructor
Instance methods.
- #to_json ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Entity
Instance methods
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/geoapi/entity.rb', line 9 def initialize(attrs) @raw_json = JSON.generate(attrs) @guid = attrs['guid'] if attrs['meta'] @name = attrs['meta']['name'] @views = attrs['meta']['views'] || [] @userviews = attrs['meta']['userviews'] || [] @type = attrs['meta']['type'].to_sym end self end |
Instance Attribute Details
#geom ⇒ Object (readonly)
Returns the value of attribute geom.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def geom @geom end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def guid @guid end |
#latitude ⇒ Object (readonly) Also known as: lat
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object (readonly) Also known as: lon
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def name @name end |
#raw_json ⇒ Object (readonly)
Returns the value of attribute raw_json.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def raw_json @raw_json end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def url @url end |
#userviews ⇒ Object (readonly)
Returns the value of attribute userviews.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def userviews @userviews end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
3 4 5 |
# File 'lib/geoapi/entity.rb', line 3 def views @views end |
Instance Method Details
#to_json ⇒ Object
25 26 27 |
# File 'lib/geoapi/entity.rb', line 25 def to_json self.raw_json end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/geoapi/entity.rb', line 21 def to_s self.name end |