Class: SuperReceptionist::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/super_receptionist/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Client

Returns a new instance of Client.



5
6
7
# File 'lib/super_receptionist/client.rb', line 5

def initialize(url)
  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/super_receptionist/client.rb', line 3

def url
  @url
end

Instance Method Details

#delete(params = {}) ⇒ Object



22
23
24
# File 'lib/super_receptionist/client.rb', line 22

def delete(params = {})
  RestClient.delete(@url, params, headers=header)
end

#get(params = {}) ⇒ Object



9
10
11
12
# 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 = {}) ⇒ Object



14
15
16
# File 'lib/super_receptionist/client.rb', line 14

def post(params = {})
  RestClient.post(@url, params, headers=header)
end

#put(params = {}) ⇒ Object



18
19
20
# File 'lib/super_receptionist/client.rb', line 18

def put(params = {})
  RestClient.put(@url, params, headers=header)
end