Class: Reflect::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/reflect/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/reflect/client.rb', line 12

def initialize(token)
  @token = token
end

Instance Method Details

#delete(path) ⇒ Object



28
29
30
31
# File 'lib/reflect/client.rb', line 28

def delete(path)
  logger.debug { "[reflect] Sending DELETE #{URI.encode(path)}" }
  self.class.delete(URI.encode(path), options)
end

#get(path) ⇒ Object



16
17
18
# File 'lib/reflect/client.rb', line 16

def get(path)
  self.class.get(URI.encode(path), options)
end

#patch(path, content, headers = {}) ⇒ Object



33
34
35
36
37
# File 'lib/reflect/client.rb', line 33

def patch(path, content, headers={})
  opts = options(body: dump(content))
  opts[:headers].merge!(headers) unless headers.empty?
  self.class.patch(path, opts)
end

#post(path, content) ⇒ Object



20
21
22
# File 'lib/reflect/client.rb', line 20

def post(path, content)
  self.class.post(URI.encode(path), options(body: dump(content)))
end

#put(path, content) ⇒ Object



24
25
26
# File 'lib/reflect/client.rb', line 24

def put(path, content)
  self.class.put(URI.encode(path), options(body: dump(content)))
end