logan 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/lib/logan/client.rb +1 -1
- data/lib/logan/comment.rb +20 -0
- data/lib/logan/todo.rb +30 -1
- data/lib/logan/todolist.rb +4 -3
- data/lib/logan.rb +1 -0
- metadata +73 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 94f20bf4fd6774f8a25c97f764bce6bf3c425bfd
|
4
|
+
data.tar.gz: 46453bab5d5c1bd64b5e70e64e1d2af8fe99899f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd10e85b24b6579c95d1167fb2cd4ca7035b276c22a3760fa076f4a00c9024d2dc978f15ab9a84827a512582c5f9c1847e8c63d14ec93b10792d89635952dfa9
|
7
|
+
data.tar.gz: 8f454928f0da9eb75915878b12e4c9f70ea95fc5df9fe3bacaa92ad8a6ed978082ded59c788e48b7896cae67964cbef15a7a27ba6741e4a55aa26441861e65d7
|
data/lib/logan/client.rb
CHANGED
@@ -34,7 +34,7 @@ module Logan
|
|
34
34
|
self.class.basic_auth auth_hash[:username], auth_hash[:password]
|
35
35
|
|
36
36
|
# remove the access_token from the headers, if it exists
|
37
|
-
self.class.headers.reject!{ |k| k == "Authorization" }
|
37
|
+
self.class.headers.reject!{ |k, v| k == "Authorization" }
|
38
38
|
else
|
39
39
|
raise """
|
40
40
|
Incomplete authorization information passed in authorization hash.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'logan/HashConstructed'
|
2
|
+
|
3
|
+
module Logan
|
4
|
+
class Comment
|
5
|
+
include HashConstructed
|
6
|
+
|
7
|
+
attr_accessor :id
|
8
|
+
attr_accessor :content
|
9
|
+
attr_accessor :created_at
|
10
|
+
attr_accessor :updated_at
|
11
|
+
attr_reader :creator
|
12
|
+
|
13
|
+
# sets the creator for this todo
|
14
|
+
#
|
15
|
+
# @param [Object] creator person hash from API or <Logan::Person> object
|
16
|
+
def creator=(creator)
|
17
|
+
@creator = creator.is_a?(Hash) ? Logan::Person.new(creator) : creator
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/logan/todo.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'logan/HashConstructed'
|
2
|
+
require 'logan/comment'
|
2
3
|
require 'logan/person'
|
3
4
|
|
4
5
|
module Logan
|
@@ -6,9 +7,11 @@ module Logan
|
|
6
7
|
include HashConstructed
|
7
8
|
|
8
9
|
attr_accessor :id
|
10
|
+
attr_accessor :project_id
|
9
11
|
attr_accessor :content
|
10
12
|
attr_accessor :completed
|
11
|
-
attr_accessor :
|
13
|
+
attr_accessor :comments_count
|
14
|
+
attr_reader :assignee
|
12
15
|
attr_accessor :due_at
|
13
16
|
|
14
17
|
def post_json
|
@@ -28,6 +31,32 @@ module Logan
|
|
28
31
|
}.to_json
|
29
32
|
end
|
30
33
|
|
34
|
+
# refreshes the data for this todo from the API
|
35
|
+
def refresh
|
36
|
+
response = Logan::Client.get "/projects/#{project_id}/todos/#{id}.json"
|
37
|
+
initialize(response.parsed_response)
|
38
|
+
end
|
39
|
+
|
40
|
+
# returns the array of comments - potentially synchronously downloaded from API
|
41
|
+
#
|
42
|
+
# @return [Array<Logan::Comment] Array of comments on this todo
|
43
|
+
def comments
|
44
|
+
refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0
|
45
|
+
@comments ||= Array.new
|
46
|
+
end
|
47
|
+
|
48
|
+
# assigns the {#comments} from the passed array
|
49
|
+
#
|
50
|
+
# @param [Array<Object>] comment_array array of hash comments from API or <Logan::Comment> objects
|
51
|
+
# @return [Array<Logan::Comment>] array of comments for this todo
|
52
|
+
def comments=(comment_array)
|
53
|
+
@comments = comment_array.map { |obj| obj = Logan::Comment.new obj if obj.is_a?(Hash) }
|
54
|
+
end
|
55
|
+
|
56
|
+
# sets the assignee for this todo
|
57
|
+
#
|
58
|
+
# @param [Object] assignee person hash from API or <Logan::Person> object
|
59
|
+
# @return [Logan::Person] the assignee for this todo
|
31
60
|
def assignee=(assignee)
|
32
61
|
@assignee = assignee.is_a?(Hash) ? Logan::Person.new(assignee) : assignee
|
33
62
|
end
|
data/lib/logan/todolist.rb
CHANGED
@@ -67,10 +67,11 @@ module Logan
|
|
67
67
|
# in the passed hash
|
68
68
|
#
|
69
69
|
# @param [Hash] todo_hash hash possibly containing todos under 'remaining' and 'completed' keys
|
70
|
+
# @return [Array<Logan::Todo>] array of remaining and completed todos for this list
|
70
71
|
def todos=(todo_hash)
|
71
|
-
@remaining_todos = todo_hash['remaining'].map { |h| Logan::Todo.new h }
|
72
|
-
@completed_todos = todo_hash['completed'].map { |h| Logan::Todo.new h }
|
73
|
-
return
|
72
|
+
@remaining_todos = todo_hash['remaining'].map { |h| Logan::Todo.new h.merge({ :project_id => @project_id }) }
|
73
|
+
@completed_todos = todo_hash['completed'].map { |h| Logan::Todo.new h.merge({ :project_id => @project_id }) }
|
74
|
+
return @remaining_todos + @completed_todos
|
74
75
|
end
|
75
76
|
|
76
77
|
# searches the remaining and completed todos for the first todo with the substring in its content
|
data/lib/logan.rb
CHANGED
metadata
CHANGED
@@ -1,76 +1,108 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: logan
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Stephen Birarda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: httparty
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Version
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
21
19
|
version: 0.11.0
|
22
20
|
type: :runtime
|
23
|
-
version_requirements: *id001
|
24
|
-
- !ruby/object:Gem::Dependency
|
25
|
-
name: json
|
26
21
|
prerelease: false
|
27
|
-
|
28
|
-
requirements:
|
29
|
-
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.11.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
33
34
|
type: :runtime
|
34
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: yard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: redcarpet
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.3.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.3.0
|
35
69
|
description:
|
36
70
|
email: logan@birarda.com
|
37
71
|
executables: []
|
38
|
-
|
39
72
|
extensions: []
|
40
|
-
|
41
73
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
files:
|
74
|
+
files:
|
44
75
|
- lib/logan.rb
|
76
|
+
- lib/logan/HashConstructed.rb
|
45
77
|
- lib/logan/client.rb
|
78
|
+
- lib/logan/comment.rb
|
46
79
|
- lib/logan/event.rb
|
47
|
-
- lib/logan/HashConstructed.rb
|
48
80
|
- lib/logan/person.rb
|
49
81
|
- lib/logan/project.rb
|
50
82
|
- lib/logan/todo.rb
|
51
83
|
- lib/logan/todolist.rb
|
52
84
|
homepage: https://github.com/birarda/logan
|
53
|
-
licenses:
|
85
|
+
licenses:
|
54
86
|
- MIT
|
55
87
|
metadata: {}
|
56
|
-
|
57
88
|
post_install_message:
|
58
89
|
rdoc_options: []
|
59
|
-
|
60
|
-
require_paths:
|
90
|
+
require_paths:
|
61
91
|
- lib
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
requirements:
|
64
|
-
-
|
65
|
-
|
66
|
-
|
67
|
-
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
68
102
|
requirements: []
|
69
|
-
|
70
103
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.2.2
|
72
105
|
signing_key:
|
73
106
|
specification_version: 4
|
74
107
|
summary: ruby gem to communicate with new Basecamp API
|
75
108
|
test_files: []
|
76
|
-
|