wunderlist-api 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e68aa4ac174be14f12716d91ddc2dc4a2123d31e
4
- data.tar.gz: 498f293ee6e1d3cd6940f36237e903af1162d001
3
+ metadata.gz: 8c1f15bb685eb176c744a80eb26afd112703b2e7
4
+ data.tar.gz: 9e8083948c01850262620ad9eaaaff9b641a90b3
5
5
  SHA512:
6
- metadata.gz: 8accf1930143593a9d98c83432bbe1f1b866f6d295ecf0f3b6b63d2accb13be9774f37533c86c9cb0c019238d56b0f7ead75a1ff510937005cc40de0f1a2447f
7
- data.tar.gz: af16c08e8d3d29d97c6d6afacb82324896594f084bb33b69ff4da4b5a2b6e9cfb733e67d1b183d90d1e5b989a9d8599a9a7a78bd9b2e939ea4d417d93fc770eb
6
+ metadata.gz: 740cf5d84dc03f09fd357fccc6520b8b1ac2153b66cc904a5751010f47206d47c7e7c9a500b14251aa2083076e01aba26e00a5fce4e868e168158a337d188de2
7
+ data.tar.gz: 3de11ca7bc44f857ff1880bbca0d935bf233ca57ab624662fa95740e9fd518661f72dd8222da4868e426a564625bac0a16addff63cb1ff23fd304630938a567b
@@ -34,9 +34,9 @@ module Wunderlist
34
34
  list
35
35
  end
36
36
 
37
- def list(list_name)
38
- list_name = [list_name]
39
- list_id = get_list_ids(list_name)[0]
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(list_name)
62
- list_id = get_list_ids([list_name]).first
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(list_names = [], completed = false)
73
- list_ids = get_list_ids(list_names)
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(list_name, attrs = {})
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)}
@@ -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']
@@ -1,3 +1,3 @@
1
1
  module Wunderlist
2
- VERSION = "1.0.5"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -12,6 +12,7 @@ describe Wunderlist::Task do
12
12
  title
13
13
  revision
14
14
  assignee_id
15
+ created_at
15
16
  completed
16
17
  completed_at
17
18
  completed_by_id
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.5
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-09-17 00:00:00.000000000 Z
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: