Class: TINAMI::API

Inherits:
Object
  • Object
show all
Defined in:
lib/tinami/api.rb

Direct Known Subclasses

Client

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ API

Creates a new API



8
9
10
11
12
13
# File 'lib/tinami/api.rb', line 8

def initialize(options = {})
  options = TINAMI.options.merge(options)
  Configuration::OPTIONS_KEYS.each do |key|
    send("#{key}=", options[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