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 CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: b087a3d1e291c0d15bc3f0670793efc34bacec82
4
- data.tar.gz: ee682fd72327bfe37bb89574beb93c793d6d1841
5
- SHA512:
6
- metadata.gz: 555ae7a879fe6cac5dce5bf8947148ed66d3d5f472c2949adcab51d3a9ec48ee5cf0570db375ff3481c9a270d0f378d4277b8c0322085ba9f0b4f99c9c8648b1
7
- data.tar.gz: e8983b854012d5697cd75c685b24ae02a23cab7348daa068671e23b5491c6052fbb5a3b47e54ad1de560c4704ff6f63aa9bcfd588da48c94061904166629e249
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 :assignee
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
@@ -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 nil
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
@@ -1,6 +1,7 @@
1
1
  require 'httparty'
2
2
  require 'json'
3
3
 
4
+ require 'logan/comment'
4
5
  require 'logan/client'
5
6
  require 'logan/event'
6
7
  require 'logan/person'
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.6
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
- date: 2014-02-10 00:00:00 Z
13
- dependencies:
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
- prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
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
- requirement: &id002 !ruby/object:Gem::Requirement
28
- requirements:
29
- - &id003
30
- - ">="
31
- - !ruby/object:Gem::Version
32
- version: "0"
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
- version_requirements: *id002
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
- - *id003
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
- requirements:
67
- - *id003
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.0.14
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
-