class SuperReceptionist::Client

Attributes

url[R]

Public Class Methods

new(url) click to toggle source
# File lib/super_receptionist/client.rb, line 5
def initialize(url)
  @url = url
end

Public Instance Methods

delete(params = {}) click to toggle source
# File lib/super_receptionist/client.rb, line 22
def delete(params = {})
  RestClient.delete(@url, params, headers=header)
end
get(params = {}) click to toggle source
# File lib/super_receptionist/client.rb, line 9
def get(params = {})
  @url += "?#{URI.encode_www_form(params)}" if params.any?
  RestClient.get(@url, headers=header)
end
post(params = {}) click to toggle source
# File lib/super_receptionist/client.rb, line 14
def post(params = {})
  RestClient.post(@url, params, headers=header)
end
put(params = {}) click to toggle source
# File lib/super_receptionist/client.rb, line 18
def put(params = {})
  RestClient.put(@url, params, headers=header)
end

Private Instance Methods

header() click to toggle source
# File lib/super_receptionist/client.rb, line 28
def header
  { 'Content-Type' => 'application/json',
    'channel' => SuperReceptionist.channel,
    'x-api-key' => SuperReceptionist.x_api_key,
    'authorization' => SuperReceptionist.authorization
  }
end