Class: API
Instance Method Summary collapse
- #execute(endpoint, filter = {}) ⇒ Object
-
#initialize(apikey) ⇒ API
constructor
A new instance of API.
Constructor Details
#initialize(apikey) ⇒ API
Returns a new instance of API.
8 9 10 |
# File 'lib/anecdotally/api.rb', line 8 def initialize(apikey) @apikey = apikey end |
Instance Method Details
#execute(endpoint, filter = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/anecdotally/api.rb', line 12 def execute(endpoint, filter={}) #define the api extension we're going to call endpoint = "/" + endpoint #set the payload filter[:apikey] = @apikey = {:query => filter } #call the web service response = self.class.get(endpoint, ) if response["status"]=="success" return response["response"] else return {} end end |