Class: Mavenlink::Client
- Inherits:
-
Base
- Object
- Base
- Mavenlink::Client
show all
- Defined in:
- lib/mavenlink/client.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#basic_auth, #errors, #json, #path_params
Instance Method Summary
collapse
Methods inherited from Base
#as_json, #delete_request, #destroy, #get_request, #id, #join_paths, #post_request, #put_request, #reload, #request_path, #update
Constructor Details
#initialize(user_id, token) ⇒ Client
Returns a new instance of Client.
22
23
24
|
# File 'lib/mavenlink/client.rb', line 22
def initialize(user_id, token)
super({}, :basic_auth => {:username => user_id, :password => token})
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Mavenlink::Base
Instance Method Details
#all_visible_stories(options = {}) ⇒ Object
71
72
73
|
# File 'lib/mavenlink/client.rb', line 71
def all_visible_stories(options = {})
fetch('stories/all_visible', Story, options, lambda { |story| {:workspace_id => story['workspace_id']} })
end
|
#create_workspace(options) ⇒ Object
34
35
36
|
# File 'lib/mavenlink/client.rb', line 34
def create_workspace(options)
build("workspaces", Workspace, options, {})
end
|
#events(options = {}) ⇒ Object
66
67
68
|
# File 'lib/mavenlink/client.rb', line 66
def events(options = {})
fetch('events', Event, options)
end
|
#expense(expense_id) ⇒ Object
52
53
54
|
# File 'lib/mavenlink/client.rb', line 52
def expense(expense_id)
fetch("expenses/#{expense_id}", Expense, {}, lambda { |expense| {:workspace_id => expense['workspace_id']} })
end
|
#expenses(options = {}) ⇒ Object
48
49
50
|
# File 'lib/mavenlink/client.rb', line 48
def expenses(options = {})
fetch('expenses', Expense, options, lambda { |expense| {:workspace_id => expense['workspace_id']} })
end
|
#invoice(invoice_id) ⇒ Object
61
62
63
|
# File 'lib/mavenlink/client.rb', line 61
def invoice(invoice_id)
fetch("invoices/#{invoice_id}", Invoice, {}, lambda { |invoice| {:workspace_id => invoice['workspace_id']} })
end
|
#invoices(options = {}) ⇒ Object
57
58
59
|
# File 'lib/mavenlink/client.rb', line 57
def invoices(options = {})
fetch('invoices', Invoice, options, lambda { |invoice| {:workspace_id => invoice['workspace_id']} })
end
|
#stories(options = {}) ⇒ Object
75
76
77
|
# File 'lib/mavenlink/client.rb', line 75
def stories(options = {})
fetch('stories', Story, options, lambda { |story| {:workspace_id => story['workspace_id']} })
end
|
#story(story_id) ⇒ Object
79
80
81
|
# File 'lib/mavenlink/client.rb', line 79
def story(story_id)
fetch("stories/#{story_id}", Story, {}, lambda { |story| {:workspace_id => story['workspace_id']} })
end
|
#time_entries(options = {}) ⇒ Object
39
40
41
|
# File 'lib/mavenlink/client.rb', line 39
def time_entries(options = {})
fetch('time_entries', TimeEntry, options, lambda { |time_entry| {:workspace_id => time_entry['workspace_id']} })
end
|
#time_entry(time_entry_id) ⇒ Object
43
44
45
|
# File 'lib/mavenlink/client.rb', line 43
def time_entry(time_entry_id)
fetch("time_entries/#{time_entry_id}", TimeEntry, {}, lambda { |time_entry| {:workspace_id => time_entry['workspace_id']} })
end
|
#workspace(workspace_id) ⇒ Object
30
31
32
|
# File 'lib/mavenlink/client.rb', line 30
def workspace(workspace_id)
fetch("workspaces/#{workspace_id}", Workspace, {})
end
|
#workspaces(options = {}) ⇒ Object
26
27
28
|
# File 'lib/mavenlink/client.rb', line 26
def workspaces(options = {})
fetch('workspaces', Workspace, options)
end
|