Class: TWM::Sightings
- Inherits:
-
Object
- Object
- TWM::Sightings
- Defined in:
- lib/twm-ruby/api.rb
Overview
The Whale Hotline API hotline.whalemuseum.org/api
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
-
#count(params = {}) ⇒ Integer
Retrieve Hotline sighting reports.
-
#find(id) ⇒ JSON
Retrieve a specific sighting report.
-
#initialize(api) ⇒ Sightings
constructor
A new instance of Sightings.
-
#search(params = {}) ⇒ JSON
Retrieve Hotline sighting reports.
Constructor Details
#initialize(api) ⇒ Sightings
Returns a new instance of Sightings.
9 10 11 12 |
# File 'lib/twm-ruby/api.rb', line 9 def initialize(api) @api = api @api.create_session('http://hotline.whalemuseum.org') end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
7 8 9 |
# File 'lib/twm-ruby/api.rb', line 7 def api @api end |
Instance Method Details
#count(params = {}) ⇒ Integer
Retrieve Hotline sighting reports
36 37 38 |
# File 'lib/twm-ruby/api.rb', line 36 def count(params = {}) @api.get("api/count.json", params) end |
#find(id) ⇒ JSON
Retrieve a specific sighting report
54 55 56 |
# File 'lib/twm-ruby/api.rb', line 54 def find(id) @api.get("api/#{id.to_s}.json") end |
#search(params = {}) ⇒ JSON
Retrieve Hotline sighting reports
83 84 85 |
# File 'lib/twm-ruby/api.rb', line 83 def search(params = {}) @api.get("api.json", params) end |