Class: Itfollows::Client
- Inherits:
-
Object
- Object
- Itfollows::Client
- Defined in:
- lib/itfollowsclient.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(email, token) ⇒ Client
constructor
A new instance of Client.
- #list(name) ⇒ Object
- #new(name, payload) ⇒ Object
- #new_followup(name, description, percentage, tasks, id) ⇒ Object
- #show(name, id) ⇒ Object
Constructor Details
#initialize(email, token) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/itfollowsclient.rb', line 7 def initialize(email, token) @email = email @token = token end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/itfollowsclient.rb', line 5 def email @email end |
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/itfollowsclient.rb', line 5 def token @token end |
Instance Method Details
#list(name) ⇒ Object
12 13 14 15 16 |
# File 'lib/itfollowsclient.rb', line 12 def list(name) uri = uri(name) response = get(name, uri, email, token) JSON.parse(response.body) end |
#new(name, payload) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/itfollowsclient.rb', line 26 def new(name, payload) payload = {'line_entry' => {"data" => payload}} uri = uri(name) response = post(name, payload, uri, email, token) JSON.parse(response.body) end |
#new_followup(name, description, percentage, tasks, id) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/itfollowsclient.rb', line 19 def new_followup(name, description, percentage, tasks, id) uri = uri_for_update(name, id) payload = {"line_entry"=>{"followups_attributes"=>{"0"=>{"description"=> description, "percentage"=> percentage, "tasks"=>tasks}}}, "id"=> id} response = patch(name, payload, uri, email, token) JSON.parse(response.body) end |
#show(name, id) ⇒ Object
33 34 35 36 37 |
# File 'lib/itfollowsclient.rb', line 33 def show(name, id) uri = uri_for_show(name, id) response = get(name, uri, email, token) JSON.parse(response.body) end |