Class: TINAMI::API
- Inherits:
-
Object
- Object
- TINAMI::API
- Defined in:
- lib/tinami/api.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request.
-
#initialize(options = {}) ⇒ API
constructor
Creates a new API.
-
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request.
Constructor Details
#initialize(options = {}) ⇒ API
Creates a new API
8 9 10 11 12 13 |
# File 'lib/tinami/api.rb', line 8 def initialize( = {}) = TINAMI..merge() Configuration::OPTIONS_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request
16 17 18 19 |
# File 'lib/tinami/api.rb', line 16 def get(path, params = {}) response = RestClient.get(endpoint + path, header.merge(:params => params)) parse_response(response) end |
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request
22 23 24 25 |
# File 'lib/tinami/api.rb', line 22 def post(path, params = {}) response = RestClient.post(endpoint + path, params, header) parse_response(response) end |