Class: Flydata::Api::Base
- Inherits:
-
Object
- Object
- Flydata::Api::Base
- Defined in:
- lib/flydata/api/base.rb
Instance Method Summary collapse
- #create(params = {}) ⇒ Object
-
#initialize(api_client) ⇒ Base
constructor
A new instance of Base.
- #list(params = {}) ⇒ Object
Constructor Details
#initialize(api_client) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/flydata/api/base.rb', line 4 def initialize(api_client) @client = api_client end |
Instance Method Details
#create(params = {}) ⇒ Object
10 11 12 13 |
# File 'lib/flydata/api/base.rb', line 10 def create(params={}) params.each {|k, v| @url_path.gsub!(/:#{k}/, v.to_s)} @client.post(@url_path, @model_name => params) end |
#list(params = {}) ⇒ Object
7 8 9 |
# File 'lib/flydata/api/base.rb', line 7 def list(params={}) @client.get(@url_path) end |