Class: Reflect::Client
- Inherits:
-
Object
- Object
- Reflect::Client
- Includes:
- HTTParty
- Defined in:
- lib/reflect/client.rb
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #keyspace(slug) ⇒ Object
- #post(path, content) ⇒ Object
- #put(path, content) ⇒ Object
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/reflect/client.rb', line 11 def initialize(token) @token = token end |
Instance Method Details
#get(path) ⇒ Object
26 27 28 |
# File 'lib/reflect/client.rb', line 26 def get(path) self.class.get(path, ) end |
#keyspace(slug) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/reflect/client.rb', line 15 def keyspace(slug) res = get("/v1/keyspaces/#{slug}") if res.response.code == "200" Keyspace.new(self, JSON.parse(res.body)) else # TODO: What happens if we failed to look this up or whatever? nil end end |
#post(path, content) ⇒ Object
30 31 32 |
# File 'lib/reflect/client.rb', line 30 def post(path, content) self.class.post(path, (body: dump(content))) end |
#put(path, content) ⇒ Object
34 35 36 |
# File 'lib/reflect/client.rb', line 34 def put(path, content) self.class.put(path, (body: dump(content))) end |