Class: Thingdeck::Wrapper
- Inherits:
-
Object
- Object
- Thingdeck::Wrapper
- Defined in:
- lib/thingdeck/wrapper.rb
Instance Method Summary collapse
- #authorized? ⇒ Boolean
- #collections ⇒ Object
-
#initialize(app_id, secret) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #perform_request(need_auth = true) ⇒ Object
- #things ⇒ Object
Constructor Details
#initialize(app_id, secret) ⇒ Wrapper
Returns a new instance of Wrapper.
3 4 5 |
# File 'lib/thingdeck/wrapper.rb', line 3 def initialize(app_id, secret) @token = authenticate(app_id, secret) end |
Instance Method Details
#authorized? ⇒ Boolean
7 8 9 |
# File 'lib/thingdeck/wrapper.rb', line 7 def !!@token end |
#collections ⇒ Object
11 12 13 |
# File 'lib/thingdeck/wrapper.rb', line 11 def collections @collections ||= Collection.new(self) end |
#perform_request(need_auth = true) ⇒ Object
19 20 21 22 23 |
# File 'lib/thingdeck/wrapper.rb', line 19 def perform_request(need_auth = true) raise 'Not Authorized' if need_auth and not response = yield(connection) parse_body(response) end |
#things ⇒ Object
15 16 17 |
# File 'lib/thingdeck/wrapper.rb', line 15 def things @things ||= Thing.new(self) end |