class DaFace::Api::Adapter

Attributes

connection[R]

Public Class Methods

new(adapter_class = DaFace.configuration.adapter_class) click to toggle source
# File lib/da_face/api/adapter.rb, line 8
def initialize adapter_class = DaFace.configuration.adapter_class
  @connection = adapter_class.new
end

Public Instance Methods

get(path, params={}) click to toggle source

Performs a get operation

params is a level 1 hash that should contain params for url

# File lib/da_face/api/adapter.rb, line 18
def get path, params={}
  response = connection.get path, params
  return symbolize_keys(response.keys, response)
end
post(path, payload) click to toggle source

Performs a post operation

payload is a hash that will be parsed to json and sent as body

# File lib/da_face/api/adapter.rb, line 26
def post path, payload
  response = connection.post path, payload
  return true if response.empty?
  return symbolize_keys(response.keys, response)
end
put(path, payload) click to toggle source

Performs a put operation

payload is a hash that will be parsed to json and sent as body

# File lib/da_face/api/adapter.rb, line 35
def put path, payload
  response = connection.put path, payload
  return true if response.empty?
  return symbolize_keys(response.keys, response)
end