logan 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -7
  2. data/lib/logan/todolist.rb +39 -2
  3. metadata +40 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 6d977ec77d68ec25fbb28776eb247d6fa79dd5ba
4
- data.tar.gz: e15d414e057c515179b4becb006f56d221ac77fc
5
- SHA512:
6
- metadata.gz: 7be2adee6777733a08a0a2cec6463ae4a6756191fa29742180857f8ca9205756cf78a0dfc950324f33200592d0db504b697ec70987eae58e43f144053c39233c
7
- data.tar.gz: 3669f94661c114390342d9c204dcc2a4ccadc3cdf9e1c194d3ce9c62ade6aae5bac2aa39da427b90170baac51d4a9301cf82bbad9d027a07f22965466660af12
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b087a3d1e291c0d15bc3f0670793efc34bacec82
4
+ data.tar.gz: ee682fd72327bfe37bb89574beb93c793d6d1841
5
+ SHA512:
6
+ metadata.gz: 555ae7a879fe6cac5dce5bf8947148ed66d3d5f472c2949adcab51d3a9ec48ee5cf0570db375ff3481c9a270d0f378d4277b8c0322085ba9f0b4f99c9c8648b1
7
+ data.tar.gz: e8983b854012d5697cd75c685b24ae02a23cab7348daa068671e23b5491c6052fbb5a3b47e54ad1de560c4704ff6f63aa9bcfd588da48c94061904166629e249
@@ -10,9 +10,11 @@ module Logan
10
10
  attr_accessor :name
11
11
  attr_accessor :description
12
12
  attr_accessor :completed
13
- attr_accessor :remaining_todos
14
- attr_accessor :completed_todos
13
+ attr_accessor :remaining_count
14
+ attr_accessor :completed_count
15
15
  attr_accessor :url
16
+ attr_writer :remaining_todos
17
+ attr_writer :completed_todos
16
18
 
17
19
  # intializes a todo list by calling the HashConstructed initialize method and
18
20
  # setting both @remaining_todos and @completed_todos to empty arrays
@@ -26,6 +28,41 @@ module Logan
26
28
  { :name => @name, :description => @description }.to_json
27
29
  end
28
30
 
31
+ # refreshes the data for this todo list from the API
32
+ def refresh
33
+ response = Logan::Client.get "/projects/#{@project_id}/todolists/#{@id}.json"
34
+ initialize(response.parsed_response)
35
+ end
36
+
37
+ # returns the array of remaining todos - potentially synchronously downloaded from API
38
+ #
39
+ # @return [Array<Logan::Todo>] Array of remaining todos for this todo list
40
+ def remaining_todos
41
+ if @remaining_todos.empty? && @remaining_count > 0
42
+ refresh
43
+ end
44
+
45
+ return @remaining_todos
46
+ end
47
+
48
+ # returns the array of completed todos - potentially synchronously downloaded from API
49
+ #
50
+ # @return [Array<Logan::Todo>] Array of completed todos for this todo list
51
+ def completed_todos
52
+ if @completed_todos.empty? && @completed_count > 0
53
+ refresh
54
+ end
55
+
56
+ return @completed_todos
57
+ end
58
+
59
+ # returns an array of all todos, completed and remaining - potentially synchronously downloaded from API
60
+ #
61
+ # @return [Array<Logan::Todo>] Array of completed todos for this todo list
62
+ def todos
63
+ remaining_todos + completed_todos
64
+ end
65
+
29
66
  # assigns the {#remaining_todos} and {#completed_todos} from the associated keys
30
67
  # in the passed hash
31
68
  #
metadata CHANGED
@@ -1,49 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: logan
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Stephen Birarda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
11
+
12
+ date: 2014-02-10 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
14
15
  name: httparty
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 0.11.0
20
- type: :runtime
21
16
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "="
20
+ - !ruby/object:Gem::Version
26
21
  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: '0'
34
22
  type: :runtime
23
+ version_requirements: *id001
24
+ - !ruby/object:Gem::Dependency
25
+ name: json
35
26
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
27
+ requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - &id003
30
+ - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id002
41
35
  description:
42
36
  email: logan@birarda.com
43
37
  executables: []
38
+
44
39
  extensions: []
40
+
45
41
  extra_rdoc_files: []
46
- files:
42
+
43
+ files:
47
44
  - lib/logan.rb
48
45
  - lib/logan/client.rb
49
46
  - lib/logan/event.rb
@@ -53,27 +50,27 @@ files:
53
50
  - lib/logan/todo.rb
54
51
  - lib/logan/todolist.rb
55
52
  homepage: https://github.com/birarda/logan
56
- licenses:
53
+ licenses:
57
54
  - MIT
58
55
  metadata: {}
56
+
59
57
  post_install_message:
60
58
  rdoc_options: []
61
- require_paths:
59
+
60
+ require_paths:
62
61
  - lib
63
- required_ruby_version: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - '>='
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- required_rubygems_version: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - '>='
71
- - !ruby/object:Gem::Version
72
- version: '0'
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - *id003
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - *id003
73
68
  requirements: []
69
+
74
70
  rubyforge_project:
75
- rubygems_version: 2.1.10
71
+ rubygems_version: 2.0.14
76
72
  signing_key:
77
73
  specification_version: 4
78
74
  summary: ruby gem to communicate with new Basecamp API
79
75
  test_files: []
76
+