Class: Reflect::Client
- Inherits:
-
Object
- Object
- Reflect::Client
- Includes:
- HTTParty
- Defined in:
- lib/reflect/client.rb
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path) ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #patch(path, content, headers = {}) ⇒ Object
- #post(path, content) ⇒ Object
- #put(path, content) ⇒ Object
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), ) end |
#get(path) ⇒ Object
16 17 18 |
# File 'lib/reflect/client.rb', line 16 def get(path) self.class.get(URI.encode(path), ) end |
#patch(path, content, headers = {}) ⇒ Object
33 34 35 36 37 |
# File 'lib/reflect/client.rb', line 33 def patch(path, content, headers={}) opts = (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), (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), (body: dump(content))) end |