wunderlist-api 0.3.0 → 0.4.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: b9a66faf1a83914fca86c9b0d596b8c189959c6c
4
- data.tar.gz: c623007071ce4c1b323db1c1c86b93bebb366dba
3
+ metadata.gz: 031a07e0769feb8d29e850090f1c80d68cc0790e
4
+ data.tar.gz: 3bf147f95a1814be13d3d9c5fc57290a44fd00d5
5
5
  SHA512:
6
- metadata.gz: 1dd5de2ced7b20137cc9114b397a12df529bc511609b88c68da56e290134eba23c09d2c40bbaa6db90ac9041057a2d4d139cfae22261067eda96bd723a2667ce
7
- data.tar.gz: d31316eed312af97fd2b5188d94e964dce4da0bb002724d805d233524ae9611e3b869c31ebe226bcf058767be2f164c118dbf68c6edd6ca3bd5e9ac7fe2a5a16
6
+ metadata.gz: 13e0acf1aa75b911b0b3a956a210375aad0fd42cbbb96f71b48ec42df00ec381c13a4343f7bf9619b509b02b1e6adb3e3c4b1975e97667c45159ac067468b714
7
+ data.tar.gz: ca27362e6fbdf20b8fec1ef7ae7e8272be7ab8ce304335134182a0e8744a67dfc622b076ae52c631ae52ea79b37c5f91451e0b7130de861aebe261bba62ef500
data/README.md CHANGED
@@ -19,7 +19,7 @@ Or install it yourself as:
19
19
  You should require this gem like;
20
20
 
21
21
  ```
22
- require 'wunderlist/api'
22
+ require 'wunderlist'
23
23
  ```
24
24
 
25
25
  ## Usage
@@ -7,12 +7,16 @@ module Wunderlist
7
7
 
8
8
  attr_accessor :id, :title, :api, :created_at, :revision
9
9
 
10
- def initialize(options = {})
11
- @api = options['api']
12
- @id = options['id']
13
- @title = options['title']
14
- @created_at = options['created_at']
15
- @revision = options['revision']
10
+ def initialize(attrs = {})
11
+ @api = attrs['api']
12
+ @id = attrs['id']
13
+ @title = attrs['title']
14
+ @created_at = attrs['created_at']
15
+ @revision = attrs['revision']
16
+ end
17
+
18
+ def new_task(list_name, attrs = {})
19
+ self.api.new_task(list_name, attrs)
16
20
  end
17
21
 
18
22
  def tasks(completed = false)
@@ -21,12 +25,12 @@ module Wunderlist
21
25
 
22
26
  private
23
27
 
24
- def set_attrs(res)
25
- self.api = res['api']
26
- self.id = res['id']
27
- self.title= res['content']
28
- self.created_at = res['created_at']
29
- self.revision = res['revision']
28
+ def set_attrs(attrs = {})
29
+ self.api = attrs['api']
30
+ self.id = attrs['id']
31
+ self.title= attrs['content']
32
+ self.created_at = attrs['created_at']
33
+ self.revision = attrs['revision']
30
34
  end
31
35
 
32
36
  end
@@ -7,26 +7,26 @@ module Wunderlist
7
7
 
8
8
  attr_accessor :id, :content, :api, :task_id, :created_at, :updated_at, :revision
9
9
 
10
- def initialize(options = {})
11
- @api = options['api']
12
- @id = options['id']
13
- @task_id = options['task_id']
14
- @content = options['content']
15
- @created_at = options['created_at']
16
- @updated_at = options['updated_at']
17
- @revision = options['revision']
10
+ def initialize(attrs = {})
11
+ @api = attrs['api']
12
+ @id = attrs['id']
13
+ @task_id = attrs['task_id']
14
+ @content = attrs['content']
15
+ @created_at = attrs['created_at']
16
+ @updated_at = attrs['updated_at']
17
+ @revision = attrs['revision']
18
18
  end
19
19
 
20
20
  private
21
21
 
22
- def set_attrs(res)
23
- self.api = res['api']
24
- self.id = res['id']
25
- self.task_id = res['task_id']
26
- self.content = res['content']
27
- self.created_at = res['created_at']
28
- self.updated_at = res['updated_at']
29
- self.revision = res['revision']
22
+ def set_attrs(attrs = {})
23
+ self.api = attrs['api']
24
+ self.id = attrs['id']
25
+ self.task_id = attrs['task_id']
26
+ self.content = attrs['content']
27
+ self.created_at = attrs['created_at']
28
+ self.updated_at = attrs['updated_at']
29
+ self.revision = attrs['revision']
30
30
  end
31
31
 
32
32
  end
@@ -0,0 +1,33 @@
1
+ require 'wunderlist/helper'
2
+
3
+ module Wunderlist
4
+ class Subtask
5
+
6
+ include Wunderlist::Helper
7
+
8
+ attr_accessor :id, :api, :task_id, :created_at, :created_by_id, :revision, :title
9
+
10
+ def initialize(attrs = {})
11
+ @id = attrs['id']
12
+ @api = attrs['api']
13
+ @task_id = attrs['task_id']
14
+ @created_at = attrs['created_at']
15
+ @created_by_id = attrs['created_by_id']
16
+ @revision = attrs['revision']
17
+ @title = attrs['title']
18
+ end
19
+
20
+ private
21
+
22
+ def set_attrs(attrs = {})
23
+ @id = attrs['id']
24
+ @api = attrs['api']
25
+ @task_id = attrs['task_id']
26
+ @created_at = attrs['created_at']
27
+ @created_by_id = attrs['created_by_id']
28
+ @revision = attrs['revision']
29
+ @title = attrs['title']
30
+ end
31
+
32
+ end
33
+ end
@@ -1,5 +1,6 @@
1
1
  require 'wunderlist/note'
2
2
  require 'wunderlist/task_comment'
3
+ require 'wunderlist/subtask'
3
4
  require 'wunderlist/helper'
4
5
 
5
6
  module Wunderlist
@@ -9,18 +10,18 @@ module Wunderlist
9
10
 
10
11
  attr_accessor :api, :title, :assignee_id, :completed, :revision, :recurrence_type, :recurrence_count, :due_date, :starred, :id, :list_id, :created_at
11
12
 
12
- def initialize(options = {})
13
- @api = options['api']
14
- @id = options['id']
15
- @list_id = options['list_id']
16
- @title = options['title']
17
- @revision = options['revision']
18
- @assignee_id = options['assignee_id']
19
- @completed = options['completed']
20
- @recurrence_type = options['recurrence_type']
21
- @recurrence_count = options['recurrence_count']
22
- @due_date = options['due_date']
23
- @starred = options['starred']
13
+ def initialize(attrs = {})
14
+ @api = attrs['api']
15
+ @id = attrs['id']
16
+ @list_id = attrs['list_id']
17
+ @title = attrs['title']
18
+ @revision = attrs['revision']
19
+ @assignee_id = attrs['assignee_id']
20
+ @completed = attrs['completed']
21
+ @recurrence_type = attrs['recurrence_type']
22
+ @recurrence_count = attrs['recurrence_count']
23
+ @due_date = attrs['due_date']
24
+ @starred = attrs['starred']
24
25
  end
25
26
 
26
27
  def task_comments
@@ -62,16 +63,39 @@ module Wunderlist
62
63
 
63
64
  end
64
65
 
66
+ def new_subtask(attrs = {})
67
+ attrs.stringify_keys
68
+ s_t = Wunderlist::Subtask.new(attrs)
69
+ s_t.api = self.api
70
+ s_t.task_id = self.id
71
+
72
+ s_t
73
+
74
+ end
75
+
76
+ def subtasks
77
+ res = self.api.request :get, 'api/v1/subtasks', {:task_id => self.id}
78
+ subtasks = []
79
+ res.each do |r|
80
+ subtask = Wunderlist::Subtask.new(r)
81
+ subtask.api = self
82
+ subtasks << subtask
83
+ end
84
+
85
+ subtasks
86
+
87
+ end
88
+
65
89
  private
66
90
 
67
- def set_attrs(res)
68
- self.id = res['id']
69
- self.title = res['title']
70
- self.created_at = res['created_at']
71
- self.completed = res['completed']
72
- self.list_id = res['list_id']
73
- self.starred = res['starred']
74
- self.revision = res['revision']
91
+ def set_attrs(attrs = {})
92
+ self.id = attrs['id']
93
+ self.title = attrs['title']
94
+ self.created_at = attrs['created_at']
95
+ self.completed = attrs['completed']
96
+ self.list_id = attrs['list_id']
97
+ self.starred = attrs['starred']
98
+ self.revision = attrs['revision']
75
99
  end
76
100
 
77
101
  end
@@ -7,26 +7,26 @@ module Wunderlist
7
7
 
8
8
  attr_accessor :text, :type, :id, :api, :task_id, :revision, :created_at
9
9
 
10
- def initialize(options = {})
11
- @api = options['api']
12
- @id = options['id']
13
- @task_id = options['task_id']
14
- @revision = options['revision']
15
- @text = options['text']
16
- @type = options['type']
17
- @created_at = options['created_at']
10
+ def initialize(attrs = {})
11
+ @api = attrs['api']
12
+ @id = attrs['id']
13
+ @task_id = attrs['task_id']
14
+ @revision = attrs['revision']
15
+ @text = attrs['text']
16
+ @type = attrs['type']
17
+ @created_at = attrs['created_at']
18
18
  end
19
19
 
20
20
  private
21
21
 
22
- def set_attrs(res)
23
- self.api = res['api']
24
- self.id = res['id']
25
- self.task_id = res['task_id']
26
- self.revision = res['revision']
27
- self.text = res['text']
28
- self.type = res['type']
29
- self.created_at = res['created_at']
22
+ def set_attrs(attrs = {})
23
+ self.api = attrs['api']
24
+ self.id = attrs['id']
25
+ self.task_id = attrs['task_id']
26
+ self.revision = attrs['revision']
27
+ self.text = attrs['text']
28
+ self.type = attrs['type']
29
+ self.created_at = attrs['created_at']
30
30
  end
31
31
 
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module Wunderlist
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - shun3475
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,6 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
- - ".travis.yml"
93
92
  - Gemfile
94
93
  - LICENSE.txt
95
94
  - README.md
@@ -99,6 +98,7 @@ files:
99
98
  - lib/wunderlist/helper.rb
100
99
  - lib/wunderlist/list.rb
101
100
  - lib/wunderlist/note.rb
101
+ - lib/wunderlist/subtask.rb
102
102
  - lib/wunderlist/task.rb
103
103
  - lib/wunderlist/task_comment.rb
104
104
  - lib/wunderlist/version.rb
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0