Class: Trolley::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/trolley/Client.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Client

Returns a new instance of Client.



11
12
13
# File 'lib/trolley/Client.rb', line 11

def initialize(config)
  @config = config
end

Instance Method Details

#delete(endPoint, body = '') ⇒ Object



24
25
26
27
# File 'lib/trolley/Client.rb', line 24

def delete(endPoint, body = '')
  body = body.to_json if body != ''
  send_request(endPoint, 'DELETE', body)
end

#get(endPoint) ⇒ Object



15
16
17
# File 'lib/trolley/Client.rb', line 15

def get(endPoint)
  send_request(endPoint, 'GET')
end

#patch(endPoint, body) ⇒ Object



29
30
31
32
# File 'lib/trolley/Client.rb', line 29

def patch(endPoint, body)
  body = body.to_json
  send_request(endPoint, 'PATCH', body)
end

#post(endPoint, body) ⇒ Object



19
20
21
22
# File 'lib/trolley/Client.rb', line 19

def post(endPoint, body)
  body = body.to_json
  send_request(endPoint, 'POST', body)
end