logan 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c585ab8667cacf627cb22756a3b5e79c03c943d4
4
- data.tar.gz: b1446c01c02d4ae765b5e3a5d1024dab9ce4917f
3
+ metadata.gz: 1822a39bbf699d36bbcd41d341786a984936358c
4
+ data.tar.gz: 74679a3a940ca1e28c870436cd6ea0bbd9a6fbfb
5
5
  SHA512:
6
- metadata.gz: 0a415d2b10fe20bf8de8103031cf0c204f8a0ca9646a8c8283d32a491283dcd4bc6de8242fa54d47cdb3329d28f58507998130d84fcfa49f3f5ad4c5d367b716
7
- data.tar.gz: f4ab9aef971f044f394617948c301e7a0494a1807d4cd79d5de3250baff7f87d19a7f52385d0974b1310362451e7ddc51a63a616d4c5de4df39d86c8e1d3f74f
6
+ metadata.gz: f601b37125b722a12a36e485ee940916bdd81894448529fca149089909163040e04f03724f86addd4a238de3bb8250f9313a1141e1576ace9d005e240a9a519e
7
+ data.tar.gz: 33d7fe47676149b50cac2f465bf20aeb57104f3a45ec3fb28e83ec3440f7520b1785fdb7f5435ee932ec2368bbea178142bf23f47680757cb63a8c627d03394d
data/lib/logan.rb CHANGED
@@ -6,7 +6,9 @@ require 'logan/client'
6
6
  require 'logan/event'
7
7
  require 'logan/person'
8
8
  require 'logan/project'
9
+ require 'logan/project_template'
9
10
  require 'logan/todo'
10
11
  require 'logan/todolist'
12
+ require 'logan/message'
11
13
  require 'logan/errors'
12
14
  require 'logan/response_handler'
@@ -2,12 +2,18 @@
2
2
  # http://stackoverflow.com/questions/1572660/is-there-a-way-to-initialize-an-object-through-a-hash
3
3
 
4
4
  module HashConstructed
5
-
6
- # initalizes the object by pulling key-value pairs from the hash and
5
+
6
+ attr_accessor :attributes, :json_raw
7
+
8
+ # initalizes the object by pulling key-value pairs from the hash and
7
9
  # mapping them to the object's instance variables
8
- #
10
+ #
9
11
  # @param [Hash] h hash containing key-value pairs to map to object instance variables
10
12
  def initialize(h)
11
- h.each { |k,v| send("#{k}=",v) if respond_to?("#{k}=") }
13
+ @attributes = h
14
+ h.each do |k,v|
15
+ next unless respond_to?("#{k}=")
16
+ send("#{k}=",v)
17
+ end
12
18
  end
13
19
  end
data/lib/logan/client.rb CHANGED
@@ -47,9 +47,20 @@ module Logan
47
47
  # get projects from Basecamp API
48
48
  #
49
49
  # @return [Array<Logan::Project>] array of {Logan::Project} instances
50
- def projects
51
- response = self.class.get '/projects.json'
52
- handle_response(response, Proc.new {|h| Logan::Project.new(h) })
50
+ def projects(id = nil)
51
+ if id
52
+ project_by_id id
53
+ else
54
+ all_projects
55
+ end
56
+ end
57
+
58
+ # get project templates from Basecamp API
59
+ #
60
+ # @return [Array<Logan::ProjectTemplate>] array of {Logan::ProjectTemplate} instances
61
+ def project_templates
62
+ response = self.class.get '/project_templates.json'
63
+ handle_response(response, Proc.new {|h| Logan::ProjectTemplate.new(h) })
53
64
  end
54
65
 
55
66
  # get active Todo lists for all projects from Basecamp API
@@ -60,10 +71,10 @@ module Logan
60
71
  handle_response(response,
61
72
  Proc.new { |h|
62
73
  list = Logan::TodoList.new(h)
63
-
74
+
64
75
  # grab the project ID for this list from the url
65
76
  list.project_id = list.url.scan( /projects\/(\d+)/).last.first
66
-
77
+
67
78
  # return the list so this method returns an array of lists
68
79
  list
69
80
  }
@@ -71,7 +82,7 @@ module Logan
71
82
  end
72
83
 
73
84
  def events(since_time, page = 1)
74
- response = self.class.get "/events.json?since=#{since_time.to_s}&page=#{page}"
85
+ response = self.class.get "/events.json?since=#{URI.escape since_time.to_formatted_s(:iso8601)}&page=#{page}"
75
86
  handle_response(response, Proc.new {|h| Logan::Event.new(h) })
76
87
  end
77
88
 
@@ -79,5 +90,25 @@ module Logan
79
90
  response = self.class.get "/people.json"
80
91
  handle_response(response, Proc.new {|h| Logan::Person.new(h) })
81
92
  end
93
+
94
+ def person(id)
95
+ response = self.class.get "/people/#{id}.json"
96
+ person = Logan::Person.new response
97
+ person.json_raw = response.body
98
+ person
99
+ end
100
+
101
+ private
102
+ def all_projects
103
+ response = self.class.get '/projects.json'
104
+ handle_response(response, Proc.new {|h| Logan::Project.new(h) })
105
+ end
106
+
107
+ def project_by_id id
108
+ response = self.class.get "/projects/#{id}.json"
109
+ project = Logan::Project.new response
110
+ project.json_raw = response.body
111
+ project
112
+ end
82
113
  end
83
114
  end
data/lib/logan/comment.rb CHANGED
@@ -3,18 +3,30 @@ require 'logan/HashConstructed'
3
3
  module Logan
4
4
  class Comment
5
5
  include HashConstructed
6
-
6
+
7
7
  attr_accessor :id
8
8
  attr_accessor :content
9
9
  attr_accessor :created_at
10
10
  attr_accessor :updated_at
11
+ attr_accessor :trashed
12
+ attr_accessor :private
13
+ attr_accessor :subscribers
11
14
  attr_reader :creator
12
-
15
+
16
+ def post_json
17
+ {
18
+ :content => @content,
19
+ :trashed => @trashed,
20
+ :private => @private,
21
+ :creator => @creator.nil? ? nil : @creator.to_hash
22
+ }.to_json
23
+ end
24
+
13
25
  # sets the creator for this todo
14
- #
26
+ #
15
27
  # @param [Object] creator person hash from API or <Logan::Person> object
16
28
  def creator=(creator)
17
- @creator = creator.is_a?(Hash) ? Logan::Person.new(creator) : creator
29
+ @creator = creator.is_a?(Hash) ? Logan::Person.new(creator) : creator
18
30
  end
19
31
  end
20
32
  end
data/lib/logan/event.rb CHANGED
@@ -3,9 +3,33 @@ require 'logan/HashConstructed'
3
3
  module Logan
4
4
  class Event
5
5
  include HashConstructed
6
-
6
+ include ResponseHandler
7
+
7
8
  attr_accessor :id
8
9
  attr_accessor :summary
9
10
  attr_accessor :url
10
- end
11
- end
11
+ attr_accessor :eventable
12
+ attr_accessor :updated_at
13
+ attr_accessor :created_at
14
+ attr_accessor :action
15
+ attr_accessor :summary
16
+ attr_accessor :raw_excerpt
17
+ attr_accessor :excerpt
18
+
19
+
20
+ def eventable= h
21
+ @eventable = OpenStruct.new h
22
+ end
23
+
24
+ def get
25
+ begin
26
+ response = Logan::Client.get eventable.url
27
+ o = eval("Logan::#{eventable.type}").new response.parsed_response
28
+ o.json_raw = response.body
29
+ o
30
+ rescue NameError
31
+ return nil
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,16 @@
1
+ require 'logan/HashConstructed'
2
+
3
+ module Logan
4
+ class Message
5
+ include HashConstructed
6
+
7
+ attr_accessor :id
8
+ attr_accessor :subject
9
+ attr_accessor :content
10
+ attr_accessor :private
11
+ attr_accessor :trashed
12
+ attr_accessor :subscribers
13
+ attr_accessor :creator
14
+ attr_accessor :comments
15
+ end
16
+ end
data/lib/logan/person.rb CHANGED
@@ -3,7 +3,7 @@ require 'logan/HashConstructed'
3
3
  module Logan
4
4
  class Person
5
5
  include HashConstructed
6
-
6
+
7
7
  attr_accessor :id
8
8
  attr_accessor :identity_id
9
9
  attr_accessor :name
@@ -13,9 +13,9 @@ module Logan
13
13
  attr_accessor :created_at
14
14
  attr_accessor :updated_at
15
15
  attr_accessor :url
16
-
16
+
17
17
  def to_hash
18
18
  { :id => @id, :type => "Person" }
19
19
  end
20
- end
20
+ end
21
21
  end
data/lib/logan/project.rb CHANGED
@@ -1,51 +1,76 @@
1
1
  require 'logan/HashConstructed'
2
2
  require 'logan/todolist'
3
+ require 'logan/response_handler'
3
4
 
4
5
  module Logan
5
6
  class Project
6
7
  include HashConstructed
7
-
8
+ include ResponseHandler
9
+
8
10
  attr_accessor :id
9
11
  attr_accessor :name
10
-
12
+ attr_accessor :description
13
+ attr_accessor :updated_at
14
+ attr_accessor :url
15
+ attr_accessor :app_url
16
+ attr_accessor :template
17
+ attr_accessor :archived
18
+ attr_accessor :starred
19
+ attr_accessor :trashed
20
+ attr_accessor :draft
21
+ attr_accessor :is_client_project
22
+ attr_accessor :color
23
+
11
24
  # get active todo lists for this project from Basecamp API
12
- #
25
+ #
13
26
  # @return [Array<Logan::TodoList>] array of active todo lists for this project
14
27
  def todolists
15
28
  active_response = Logan::Client.get "/projects/#{@id}/todolists.json"
16
- lists_array = active_response.parsed_response.map do |h|
29
+ lists_array = active_response.parsed_response.map do |h|
17
30
  Logan::TodoList.new h.merge({ :project_id => @id })
18
31
  end
19
32
  end
20
-
33
+
34
+ # publish this project from Basecamp API
35
+ #
36
+ # @return <Logan::Project> this project
37
+ def publish
38
+ post_params = {
39
+ :body => {}.to_json,
40
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
41
+ }
42
+
43
+ response = Logan::Client.post "/projects/#{@id}/publish.json", post_params
44
+ end
45
+
21
46
  # get completed todo lists for this project from Basecamp API
22
- #
47
+ #
23
48
  # @return [Array<Logan::TodoList>] array of completed todo lists for this project
24
49
  def completed_todolists
25
50
  completed_response = Logan::Client.get "/projects/#{@id}/todolists/completed.json"
26
- lists_array = completed_response.parsed_response.map do |h|
51
+ lists_array = completed_response.parsed_response.map do |h|
27
52
  Logan::TodoList.new h.merge({ :project_id => @id })
28
53
  end
29
54
  end
30
-
55
+
31
56
  # get both active and completed todo lists for this project from Basecamp API
32
- #
57
+ #
33
58
  # @return [Array<Logan::TodoList>] array of active and completed todo lists for this project
34
59
  def all_todolists
35
60
  todolists + completed_todolists
36
61
  end
37
-
62
+
38
63
  # get an individual todo list for this project from Basecamp API
39
- #
64
+ #
40
65
  # @param [String] list_id id for the todo list
41
66
  # @return [Logan::TodoList] todo list instance
42
67
  def todolist(list_id)
43
68
  response = Logan::Client.get "/projects/#{@id}/todolists/#{list_id}.json"
44
69
  Logan::TodoList.new response.parsed_response.merge({ :project_id => @id })
45
70
  end
46
-
71
+
47
72
  # create a todo list in this project via Basecamp API
48
- #
73
+ #
49
74
  # @param [Logan::TodoList] todo_list todo list instance to be created
50
75
  # @return [Logan::TodoList] todo list instance from Basecamp API response
51
76
  def create_todolist(todo_list)
@@ -53,7 +78,7 @@ module Logan
53
78
  :body => todo_list.post_json,
54
79
  :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
55
80
  }
56
-
81
+
57
82
  response = Logan::Client.post "/projects/#{@id}/todolists.json", post_params
58
83
  Logan::TodoList.new response.merge({ :project_id => @id })
59
84
  end
@@ -72,6 +97,15 @@ module Logan
72
97
  response = Logan::Client.post "/projects/#{@id}/accesses.json", post_params
73
98
  end
74
99
 
100
+ def add_client_by_id(id)
101
+ post_params = {
102
+ :body => { ids: [id] }.to_json,
103
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
104
+ }
105
+
106
+ response = Logan::Client.post "/projects/#{@id}/client_accesses.json", post_params
107
+ end
108
+
75
109
  def add_user_by_email(email)
76
110
  post_params = {
77
111
  :body => { email_addresses: [email] }.to_json,
@@ -80,5 +114,104 @@ module Logan
80
114
 
81
115
  response = Logan::Client.post "/projects/#{@id}/accesses.json", post_params
82
116
  end
83
- end
117
+
118
+ def add_client_by_email(email)
119
+ post_params = {
120
+ :body => { email_addresses: [email] }.to_json,
121
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
122
+ }
123
+
124
+ response = Logan::Client.post "/projects/#{@id}/client_accesses.json", post_params
125
+ end
126
+
127
+ # create a message via Basecamp API
128
+ #
129
+ # @param [String] subject subject for the new message
130
+ # @param [String] content content for the new message
131
+ # @param [Array] subscribers array of subscriber ids for the new message
132
+ # @param [Bool] private should the private flag be set for the new message
133
+ # @return [Logan::Message] message instance from Basecamp API response
134
+ def create_message(subject, content, subscribers, private)
135
+ post_params = {
136
+ :body => {subject: subject, content: content, subscribers: subscribers, private: private}.to_json,
137
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
138
+ }
139
+
140
+ response = Logan::Client.post "/projects/#{@id}/messages.json", post_params
141
+ Logan::Project.new response
142
+ end
143
+
144
+
145
+ # returns the array of remaining todos - potentially synchronously downloaded from API
146
+ #
147
+ # @return [Array<Logan::Todo>] Array of remaining todos for this todo list
148
+ def remaining_todos &block
149
+ return @remaining_todos if @remaining_todos
150
+ remaining_todos! &block
151
+ end
152
+
153
+ def remaining_todos! &block
154
+ @remaining_todos = []
155
+ if block_given?
156
+ page = 1
157
+ while true
158
+
159
+ response = Logan::Client.get "/projects/#{@id}/todos/remaining.json?page=#{page}"
160
+ list = handle_response(response, Proc.new {|h| Logan::Todo.new(h.merge({ :project_id => @id })) })
161
+ @remaining_todos << list
162
+ page += 1
163
+ break if list.size < 50
164
+ end
165
+ @remaining_todos = @remaining_todos.flatten
166
+ else
167
+ response = Logan::Client.get "/projects/#{@id}/todos/remaining.json"
168
+ @remaining_todos = handle_response(response, Proc.new {|h| Logan::Todo.new(h.merge({ :project_id => @id })) })
169
+ end
170
+ @remaining_todos
171
+ end
172
+
173
+ # returns the array of completed todos - potentially synchronously downloaded from API
174
+ #
175
+ # @return [Array<Logan::Todo>] Array of completed todos for this todo list
176
+ def completed_todos
177
+ return @completed_todos if @completed_todos
178
+ completed_todos!
179
+ end
180
+
181
+ def completed_todos!
182
+ response = Logan::Client.get "/projects/#{@id}/todos/completed.json"
183
+
184
+ @completed_todos = handle_response(response, Proc.new {|h| Logan::Todo.new(h.merge({ :project_id => @id })) })
185
+ end
186
+
187
+ # returns the array of trashed todos - potentially synchronously downloaded from API
188
+ #
189
+ # @return [Array<Logan::Todo>] Array of trashed todos for this todo list
190
+ def trashed_todos
191
+ return @trashed_todos if @trashed_todos
192
+ trashed_todos!
193
+ end
194
+
195
+ def trashed_todos!
196
+ response = Logan::Client.get "/projects/#{@id}/todos/trashed.json"
197
+
198
+ @trashed_todos = handle_response(response, Proc.new {|h| Logan::Todo.new(h.merge({ :project_id => @id })) })
199
+ end
200
+
201
+ # returns the array of todos - potentially synchronously downloaded from API
202
+ #
203
+ # @return [Array<Logan::Todo>] Array of todos for this todo list
204
+ def todos
205
+ return @todos if @todos
206
+ todos!
207
+ end
208
+
209
+ def todos!
210
+ response = Logan::Client.get "/projects/#{@id}/todos.json"
211
+
212
+ @todos = handle_response(response, Proc.new {|h| Logan::Todo.new(h.merge({ :project_id => @id })) })
213
+ end
214
+
215
+
216
+ end
84
217
  end
@@ -0,0 +1,27 @@
1
+ require 'logan/HashConstructed'
2
+
3
+ module Logan
4
+ class ProjectTemplate
5
+ include HashConstructed
6
+
7
+ attr_accessor :id
8
+ attr_accessor :name
9
+
10
+
11
+ # create a project based on this project template via Basecamp API
12
+ #
13
+ # @param [String] name name for the new project
14
+ # @param [String] description description for the new project
15
+ # @return [Logan::Project] project instance from Basecamp API response
16
+ def create_project( name, description = nil)
17
+ post_params = {
18
+ :body => {name: name, description: description}.to_json,
19
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
20
+ }
21
+
22
+ response = Logan::Client.post "/project_templates/#{@id}/projects.json", post_params
23
+ Logan::Project.new response
24
+ end
25
+
26
+ end
27
+ end
@@ -2,7 +2,9 @@ module Logan
2
2
  module ResponseHandler
3
3
  def handle_response(response, block)
4
4
  if success?(response.response)
5
- response.parsed_response.map { |h| block.call(h) }
5
+ response.parsed_response.map do |h|
6
+ block.call( h.merge({json_raw: h.to_json}) )
7
+ end
6
8
  else
7
9
  handle_error(response.response)
8
10
  end
data/lib/logan/todo.rb CHANGED
@@ -14,6 +14,16 @@ module Logan
14
14
  attr_reader :assignee
15
15
  attr_accessor :due_at
16
16
  attr_accessor :position
17
+ attr_accessor :app_url
18
+ attr_accessor :url
19
+ attr_accessor :trashed
20
+ attr_accessor :private
21
+
22
+ def initialize h
23
+ super
24
+ @project_id ||= app_url[/projects\/(\d*)\//, 1].to_i unless app_url.blank?
25
+ self
26
+ end
17
27
 
18
28
  def post_json
19
29
  {
@@ -28,11 +38,21 @@ module Logan
28
38
  :content => @content,
29
39
  :due_at => @due_at,
30
40
  :assignee => @assignee.nil? ? nil : @assignee.to_hash,
31
- :position => (@position.nil? || @position.empty?) ? 99 : @position,
41
+ :position => (@position.nil? || @position.to_s.empty?) ? 99 : @position,
32
42
  :completed => @completed
33
43
  }.to_json
34
44
  end
35
45
 
46
+ def save
47
+ put_params = {
48
+ :body => put_json,
49
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
50
+ }
51
+
52
+ response = Logan::Client.put url, put_params
53
+ initialize response.parsed_response
54
+ end
55
+
36
56
  # refreshes the data for this todo from the API
37
57
  def refresh
38
58
  response = Logan::Client.get "/projects/#{project_id}/todos/#{id}.json"
@@ -62,5 +82,19 @@ module Logan
62
82
  def assignee=(assignee)
63
83
  @assignee = assignee.is_a?(Hash) ? Logan::Person.new(assignee) : assignee
64
84
  end
85
+
86
+ # create a create in this todo list via the Basecamp API
87
+ #
88
+ # @param [Logan::Comment] todo the comment instance to create in this todo lost
89
+ # @return [Logan::Comment] the created comment returned from the Basecamp API
90
+ def create_comment(comment)
91
+ post_params = {
92
+ :body => comment.post_json,
93
+ :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
94
+ }
95
+
96
+ response = Logan::Client.post "/projects/#{@project_id}/todos/#{@id}/comments.json", post_params
97
+ Logan::Comment.new response
98
+ end
65
99
  end
66
100
  end
@@ -4,7 +4,7 @@ require 'logan/todo'
4
4
  module Logan
5
5
  class TodoList
6
6
  include HashConstructed
7
-
7
+
8
8
  attr_accessor :id
9
9
  attr_accessor :project_id
10
10
  attr_accessor :name
@@ -15,57 +15,57 @@ module Logan
15
15
  attr_accessor :url
16
16
  attr_writer :remaining_todos
17
17
  attr_writer :completed_todos
18
-
19
- # intializes a todo list by calling the HashConstructed initialize method and
18
+
19
+ # intializes a todo list by calling the HashConstructed initialize method and
20
20
  # setting both @remaining_todos and @completed_todos to empty arrays
21
21
  def initialize(h)
22
22
  @remaining_todos = []
23
23
  @completed_todos = []
24
24
  super
25
25
  end
26
-
26
+
27
27
  def post_json
28
28
  { :name => @name, :description => @description }.to_json
29
29
  end
30
-
30
+
31
31
  # refreshes the data for this todo list from the API
32
32
  def refresh
33
33
  response = Logan::Client.get "/projects/#{@project_id}/todolists/#{@id}.json"
34
34
  initialize(response.parsed_response)
35
35
  end
36
-
36
+
37
37
  # returns the array of remaining todos - potentially synchronously downloaded from API
38
- #
38
+ #
39
39
  # @return [Array<Logan::Todo>] Array of remaining todos for this todo list
40
40
  def remaining_todos
41
41
  if @remaining_todos.empty? && @remaining_count > 0
42
42
  refresh
43
43
  end
44
-
44
+
45
45
  return @remaining_todos
46
46
  end
47
-
47
+
48
48
  # returns the array of completed todos - potentially synchronously downloaded from API
49
- #
49
+ #
50
50
  # @return [Array<Logan::Todo>] Array of completed todos for this todo list
51
51
  def completed_todos
52
52
  if @completed_todos.empty? && @completed_count > 0
53
53
  refresh
54
54
  end
55
-
55
+
56
56
  return @completed_todos
57
57
  end
58
-
58
+
59
59
  # returns an array of all todos, completed and remaining - potentially synchronously downloaded from API
60
- #
60
+ #
61
61
  # @return [Array<Logan::Todo>] Array of completed todos for this todo list
62
62
  def todos
63
63
  remaining_todos + completed_todos
64
64
  end
65
-
65
+
66
66
  # assigns the {#remaining_todos} and {#completed_todos} from the associated keys
67
67
  # in the passed hash
68
- #
68
+ #
69
69
  # @param [Hash] todo_hash hash possibly containing todos under 'remaining' and 'completed' keys
70
70
  # @return [Array<Logan::Todo>] array of remaining and completed todos for this list
71
71
  def todos=(todo_hash)
@@ -73,18 +73,18 @@ module Logan
73
73
  @completed_todos = todo_hash['completed'].map { |h| Logan::Todo.new h.merge({ :project_id => @project_id }) }
74
74
  return @remaining_todos + @completed_todos
75
75
  end
76
-
76
+
77
77
  # searches the remaining and completed todos for the first todo with the substring in its content
78
- #
78
+ #
79
79
  # @param [String] substring substring to look for
80
80
  # @return [Logan::Todo] the matched todo, or nil if there wasn't one
81
- def todo_with_substring(substring)
81
+ def todo_with_substring(substring)
82
82
  issue_todo = @remaining_todos.detect{ |t| !t.content.index(substring).nil? }
83
83
  issue_todo ||= @completed_todos.detect { |t| !t.content.index(substring).nil? }
84
84
  end
85
-
85
+
86
86
  # create a todo in this todo list via the Basecamp API
87
- #
87
+ #
88
88
  # @param [Logan::Todo] todo the todo instance to create in this todo lost
89
89
  # @return [Logan::Todo] the created todo returned from the Basecamp API
90
90
  def create_todo(todo)
@@ -92,13 +92,13 @@ module Logan
92
92
  :body => todo.post_json,
93
93
  :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
94
94
  }
95
-
95
+
96
96
  response = Logan::Client.post "/projects/#{@project_id}/todolists/#{@id}/todos.json", post_params
97
97
  Logan::Todo.new response
98
98
  end
99
-
99
+
100
100
  # update a todo in this todo list via the Basecamp API
101
- #
101
+ #
102
102
  # @param [Logan::Todo] todo the todo instance to update in this todo list
103
103
  # @return [Logan::Todo] the updated todo instance returned from the Basecamp API
104
104
  def update_todo(todo)
@@ -106,17 +106,17 @@ module Logan
106
106
  :body => todo.put_json,
107
107
  :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
108
108
  }
109
-
109
+
110
110
  response = Logan::Client.put "/projects/#{@project_id}/todos/#{todo.id}.json", put_params
111
111
  Logan::Todo.new response
112
112
  end
113
-
113
+
114
114
  # delete a todo in this todo list via delete call to Basecamp API
115
- #
115
+ #
116
116
  # @param [Logan::Todo] todo the todo instance to be delete from this todo list
117
117
  # @return [HTTParty::response] response from Basecamp for delete request
118
118
  def delete_todo(todo)
119
119
  response = Logan::Client.delete "/projects/#{@project_id}/todos/#{todo.id}.json"
120
120
  end
121
- end
121
+ end
122
122
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Birarda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-22 00:00:00.000000000 Z
11
+ date: 2015-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -28,28 +28,28 @@ dependencies:
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.8'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.8'
55
55
  - !ruby/object:Gem::Dependency
@@ -73,13 +73,15 @@ extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
75
  - lib/logan.rb
76
+ - lib/logan/HashConstructed.rb
76
77
  - lib/logan/client.rb
77
78
  - lib/logan/comment.rb
78
79
  - lib/logan/errors.rb
79
80
  - lib/logan/event.rb
80
- - lib/logan/HashConstructed.rb
81
+ - lib/logan/message.rb
81
82
  - lib/logan/person.rb
82
83
  - lib/logan/project.rb
84
+ - lib/logan/project_template.rb
83
85
  - lib/logan/response_handler.rb
84
86
  - lib/logan/todo.rb
85
87
  - lib/logan/todolist.rb
@@ -93,17 +95,17 @@ require_paths:
93
95
  - lib
94
96
  required_ruby_version: !ruby/object:Gem::Requirement
95
97
  requirements:
96
- - - '>='
98
+ - - ">="
97
99
  - !ruby/object:Gem::Version
98
100
  version: 1.8.7
99
101
  required_rubygems_version: !ruby/object:Gem::Requirement
100
102
  requirements:
101
- - - '>='
103
+ - - ">="
102
104
  - !ruby/object:Gem::Version
103
105
  version: '0'
104
106
  requirements: []
105
107
  rubyforge_project:
106
- rubygems_version: 2.0.14
108
+ rubygems_version: 2.2.2
107
109
  signing_key:
108
110
  specification_version: 4
109
111
  summary: ruby gem to communicate with new Basecamp API