todoist-ruby 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +8 -8
- data/lib/todoist/config.rb +7 -7
- data/lib/todoist/version.rb +1 -1
- data/todoist.gemspec +2 -2
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 309884cfd24f5159481f04897d2a65521369d46de9b0326bc0587c446599dc7e
|
4
|
+
data.tar.gz: bc845f7ab3208f21d8eae90e04620699d56f4aef86a98f64fe81a1686f2917d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5cbba7094d34bbe6d3117f3c676d29fda609a866b651004238f2fbcf410ad6005d545788ca9342a704d5aa4992c9c350352484a08422e777709c2295d4af774
|
7
|
+
data.tar.gz: f18fdd9c2021ec9582e23ba252034fc4c241c6a5c35a88c3bb899301a4cf6a5edcd9a23317ddb0d6bd249617263e462f557575710a0eb9dccabde708a90641fb
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ Before you make any API calls, you **must** create a client using one of two met
|
|
77
77
|
|
78
78
|
#### Token
|
79
79
|
|
80
|
-
New tokens can be generated at the [Todoist App Management portal](https://developer.todoist.com/appconsole.html). Once a token has been acquired you can create a client by calling:
|
80
|
+
New tokens can be generated at the [Todoist App Management portal](https://developer.todoist.com/appconsole.html) or [General API token](https://todoist.com/prefs/integrations). Once a token has been acquired you can create a client by calling:
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
@client = Todoist::Client.create_client_by_token("my token")
|
@@ -96,9 +96,9 @@ There are two ways to force a sync in the API:
|
|
96
96
|
|
97
97
|
When objects are called using the ```add``` methods, a shallow object is created with a temporary id accessible by sending an ```id``` message. Once any of the above synchronization methods are called above, the ids are updated via a callback with their actual ids so they can be used in subsequent calls.
|
98
98
|
|
99
|
-
#### Creating an item
|
99
|
+
#### Creating an item
|
100
100
|
|
101
|
-
```ruby
|
101
|
+
```ruby
|
102
102
|
update_item = @client.sync_items.add({content: "Item3"})
|
103
103
|
## At this time update_item has a temporary id
|
104
104
|
|
@@ -116,7 +116,7 @@ queried_object = items_list[update_item.id]
|
|
116
116
|
# As is the case with other side-effects, issuing the call does not send the request immediately.
|
117
117
|
|
118
118
|
@client.sync
|
119
|
-
# Manually calling sync deletes the item
|
119
|
+
# Manually calling sync deletes the item
|
120
120
|
```
|
121
121
|
|
122
122
|
For more detailed examples, please review the unit tests located in the ```spec``` directory.
|
@@ -147,7 +147,7 @@ The library provides two defenses against this.
|
|
147
147
|
If an ```HTTP 429 Too Many Requests``` is received, the library can wait for a period of time and then retry with an exponential backoff. To configure this parameter:
|
148
148
|
|
149
149
|
```ruby
|
150
|
-
Todoist::
|
150
|
+
Todoist::Config.retry_time = 40
|
151
151
|
# Default is 20s, adds a 40s delay
|
152
152
|
```
|
153
153
|
|
@@ -156,7 +156,7 @@ Todoist::Util::Config.retry_time = 40
|
|
156
156
|
To set an artifical delay between sync requests:
|
157
157
|
|
158
158
|
```ruby
|
159
|
-
Todoist::
|
159
|
+
Todoist::Config.delay_between_requests = 2
|
160
160
|
# Default is 0, adds a 2s delay
|
161
161
|
```
|
162
162
|
|
@@ -193,7 +193,7 @@ Once tests pass cleanly, subsquent runs that do not change the network requests
|
|
193
193
|
|
194
194
|
Instead of:
|
195
195
|
```
|
196
|
-
Todoist::
|
196
|
+
Todoist::Config.token = "my token"
|
197
197
|
```
|
198
198
|
|
199
199
|
Use:
|
@@ -232,6 +232,7 @@ Use:
|
|
232
232
|
|
233
233
|
|
234
234
|
## Version History
|
235
|
+
* 0.2.3: Updated to v8 endpoints
|
235
236
|
* 0.2.2: For some code paths, it seems OpenSSL does not get loaded. Added require 'openssl' to network helper
|
236
237
|
* 0.2.1: Major refactoring of library to support implementations that require multi-user support in a concurrent environment (e.g. Rails app). The previous implementation relied heavily on class singletons. Internally, the code has been cleaned up significantly. Due to the scale of changes, 0.2.1 is not compatible 0.1.x versions of the library.
|
237
238
|
* 0.1.3: Changed ```Todoist::Sync``` managers so that the update method uses a hash instead of an OpenStruct. The OpenStruct creates errors when an OpenStruct passed from a previous call is used. The hash helps the caller make fewer mistakes.
|
@@ -246,4 +247,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/h6y3/t
|
|
246
247
|
## License
|
247
248
|
|
248
249
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
249
|
-
|
data/lib/todoist/config.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Todoist
|
2
2
|
class Config
|
3
|
-
TODOIST_API_URL = "https://todoist.com/
|
4
|
-
|
3
|
+
TODOIST_API_URL = "https://api.todoist.com/sync/v8"
|
4
|
+
|
5
5
|
# List of commands supported
|
6
6
|
@@command_list = [
|
7
7
|
TODOIST_SYNC_COMMAND = "/sync",
|
@@ -24,13 +24,13 @@ module Todoist
|
|
24
24
|
TODOIST_BACKUPS_GET_COMMAND = "/backups/get",
|
25
25
|
TODOIST_USER_LOGIN_COMMAND = "/user/login"
|
26
26
|
]
|
27
|
-
|
27
|
+
|
28
28
|
# Map of commands to URIs
|
29
29
|
@@uri = nil
|
30
|
-
|
30
|
+
|
31
31
|
# Artificial delay between requests to avoid API throttling
|
32
32
|
@@delay_between_requests = 0
|
33
|
-
|
33
|
+
|
34
34
|
# Should API throttling happen (HTTP Error 429), retry_time between requests
|
35
35
|
# with exponential backoff
|
36
36
|
@@retry_time = 20
|
@@ -42,11 +42,11 @@ module Todoist
|
|
42
42
|
def self.retry_time
|
43
43
|
@@retry_time
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def self.delay_between_requests=(delay_between_requests)
|
47
47
|
@@delay_between_requests = delay_between_requests
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def self.delay_between_requests
|
51
51
|
@@delay_between_requests
|
52
52
|
end
|
data/lib/todoist/version.rb
CHANGED
data/todoist.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_development_dependency "bundler", "~> 1
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.0.1"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
36
|
spec.add_development_dependency "pry", "~> 0.10"
|
@@ -40,5 +40,5 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
41
41
|
spec.add_dependency "multipart-post", "~> 2.0"
|
42
42
|
spec.add_dependency "mimemagic", "~> 0.3"
|
43
|
-
|
43
|
+
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todoist-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Han Yuan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,8 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
- !ruby/object:Gem::Version
|
219
219
|
version: '0'
|
220
220
|
requirements: []
|
221
|
-
|
222
|
-
rubygems_version: 2.5.2.1
|
221
|
+
rubygems_version: 3.0.3
|
223
222
|
signing_key:
|
224
223
|
specification_version: 4
|
225
224
|
summary: This gem provides access to the latest Todoist API.
|