Class: Vermonster::Client
- Inherits:
-
Object
- Object
- Vermonster::Client
- Includes:
- Authentication, Lists, Tasks, Users
- Defined in:
- lib/vermonster.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
- #connect!(token = nil) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Users
Methods included from Tasks
Methods included from Lists
Methods included from Authentication
#authorize_url, #authorized?, #token!, #use_token!
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 |
# File 'lib/vermonster.rb', line 14 def initialize(={}) @client = self.connect! end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
12 13 14 |
# File 'lib/vermonster.rb', line 12 def client @client end |
Class Method Details
.connection ⇒ Object
31 32 33 |
# File 'lib/vermonster.rb', line 31 def self.connection @@connection end |
Instance Method Details
#connect!(token = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vermonster.rb', line 20 def connect!(token = nil) @@connection = Faraday.new(:url => "https://api.cheddarapp.com/v1") do |f| f.headers["Authorization"] = "Bearer #{token}" if !token.nil? f.request :json f.response :json, :content_type => /\bjson$/ f.adapter Faraday.default_adapter end self end |