wunderlist-api 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wunderlist/api.rb +13 -10
- data/lib/wunderlist/task.rb +1 -0
- data/lib/wunderlist/version.rb +1 -1
- data/spec/wunderlist/task_spec.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c1f15bb685eb176c744a80eb26afd112703b2e7
|
4
|
+
data.tar.gz: 9e8083948c01850262620ad9eaaaff9b641a90b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 740cf5d84dc03f09fd357fccc6520b8b1ac2153b66cc904a5751010f47206d47c7e7c9a500b14251aa2083076e01aba26e00a5fce4e868e168158a337d188de2
|
7
|
+
data.tar.gz: 3de11ca7bc44f857ff1880bbca0d935bf233ca57ab624662fa95740e9fd518661f72dd8222da4868e426a564625bac0a16addff63cb1ff23fd304630938a567b
|
data/lib/wunderlist/api.rb
CHANGED
@@ -34,9 +34,9 @@ module Wunderlist
|
|
34
34
|
list
|
35
35
|
end
|
36
36
|
|
37
|
-
def list(
|
38
|
-
|
39
|
-
|
37
|
+
def list(list_name_or_id)
|
38
|
+
list_id = get_list_ids(list_name_or_id).first
|
39
|
+
|
40
40
|
res_list = self.request :get, "api/v1/lists/#{list_id}"
|
41
41
|
list = Wunderlist::List.new(res_list)
|
42
42
|
list.api = self
|
@@ -58,8 +58,8 @@ module Wunderlist
|
|
58
58
|
|
59
59
|
end
|
60
60
|
|
61
|
-
def webhooks(
|
62
|
-
list_id = get_list_ids(
|
61
|
+
def webhooks(list_name_or_id)
|
62
|
+
list_id = get_list_ids(list_name_or_id).first
|
63
63
|
|
64
64
|
res_webhooks = self.request :get, 'api/v1/webhooks', { :list_id => list_id }
|
65
65
|
res_webhooks.reduce([]) do |webhooks, webhook|
|
@@ -69,8 +69,8 @@ module Wunderlist
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
def tasks(
|
73
|
-
list_ids = get_list_ids(
|
72
|
+
def tasks(list_names_or_ids = [], completed = false)
|
73
|
+
list_ids = get_list_ids(list_names_or_ids)
|
74
74
|
tasks = []
|
75
75
|
list_ids.each do |list_id|
|
76
76
|
res_tasks = self.request :get, 'api/v1/tasks', {:list_id => list_id, :completed => completed}
|
@@ -108,10 +108,9 @@ module Wunderlist
|
|
108
108
|
|
109
109
|
end
|
110
110
|
|
111
|
-
def new_webhook(
|
111
|
+
def new_webhook(list_name_or_id, attrs = {})
|
112
|
+
list_id = get_list_ids(list_name_or_id).first
|
112
113
|
attrs.stringify_keys
|
113
|
-
list_name = [list_name]
|
114
|
-
list_id = get_list_ids(list_name)[0]
|
115
114
|
attrs['list_id'] = list_id
|
116
115
|
task = Wunderlist::Webhook.new(attrs)
|
117
116
|
task.api = self
|
@@ -199,6 +198,10 @@ module Wunderlist
|
|
199
198
|
|
200
199
|
|
201
200
|
def get_list_ids(list_names = [])
|
201
|
+
return list_names if list_names.all? {|i| i.is_a?(Integer) }
|
202
|
+
return [list_names] if list_names.is_a? Integer
|
203
|
+
list_names = [list_names] if list_names.is_a? String
|
204
|
+
|
202
205
|
lists = self.lists
|
203
206
|
if !list_names.empty?
|
204
207
|
lists = lists.select{|elm| list_names.include?(elm.title)}
|
data/lib/wunderlist/task.rb
CHANGED
@@ -18,6 +18,7 @@ module Wunderlist
|
|
18
18
|
@title = attrs['title']
|
19
19
|
@revision = attrs['revision']
|
20
20
|
@assignee_id = attrs['assignee_id']
|
21
|
+
@created_at = attrs['created_at']
|
21
22
|
@completed = attrs['completed']
|
22
23
|
@completed_at = attrs['completed_at']
|
23
24
|
@completed_by_id = attrs['completed_by_id']
|
data/lib/wunderlist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderlist-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shun3475
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,3 +135,4 @@ test_files:
|
|
135
135
|
- spec/wunderlist/task_comment_spec.rb
|
136
136
|
- spec/wunderlist/task_spec.rb
|
137
137
|
- spec/wunderlist/webhook_spec.rb
|
138
|
+
has_rdoc:
|