Class: Kisi::Client
- Inherits:
-
Object
- Object
- Kisi::Client
- Includes:
- HTTParty
- Defined in:
- lib/kisi/client.rb,
lib/kisi/client/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #get_doors ⇒ Object
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #unlock_door(door) ⇒ Object
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
10 11 12 |
# File 'lib/kisi/client.rb', line 10 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
8 9 10 |
# File 'lib/kisi/client.rb', line 8 def token @token end |
Instance Method Details
#get_doors ⇒ Object
14 15 16 |
# File 'lib/kisi/client.rb', line 14 def get_doors self.class.get("/locks/index_with_token.json?limit=10&offset=0&token=#{token}") end |
#unlock_door(door) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/kisi/client.rb', line 18 def unlock_door(door) self.class.post( "/locks/#{door["id"]}/access_with_token.json?token=#{token}", { body: { lock: door } } ) end |