inbox 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/namespace.rb +5 -8
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d21a2eeb1f9758558ebba8cedf43dfa7bc770551
|
4
|
+
data.tar.gz: 2cfe21beb20bf9f4ae435d59493bd609490b929b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c621c9e95f4a23da84f232c00872a6e4d266d4ac292747418a36eada566c16063be983386b8f92cac98d7a82865bd4cc87d8ad1bc9d4383db72e7a2a4aeef4e5
|
7
|
+
data.tar.gz: c5fff4190fe9121ac947f5da7304ad4b6bf7894f386e3f3a0ac92e0c32c6c0c21f163fa119545b4eb9db7056f7a32f457ef145099d5d7dbe9bb1d43723a5e092
|
data/README.md
CHANGED
@@ -296,15 +296,18 @@ save_to_db(last_cursor)
|
|
296
296
|
```
|
297
297
|
|
298
298
|
### Exclude changes from a specific type --- get only messages
|
299
|
+
````ruby
|
299
300
|
inbox.namespaces.first.deltas(cursor, exclude=[Inbox::Contact,
|
300
301
|
Inbox::Event,
|
301
302
|
Inbox::File,
|
302
303
|
Inbox::Tag,
|
303
304
|
Inbox::Thread]) do |event, object|
|
304
|
-
if event == 'create' or event == 'modify
|
305
|
+
if event == 'create' or event == 'modify'
|
305
306
|
puts object.subject
|
306
307
|
end
|
307
308
|
end
|
309
|
+
```
|
310
|
+
|
308
311
|
|
309
312
|
### Handling Errors
|
310
313
|
The Nilas API uses conventional HTTP response codes to indicate success or failure of an API request. The ruby gem raises these as native exceptions.
|
data/lib/namespace.rb
CHANGED
@@ -61,7 +61,7 @@ module Inbox
|
|
61
61
|
|
62
62
|
def get_cursor(timestamp)
|
63
63
|
# Get the cursor corresponding to a specific timestamp.
|
64
|
-
path = @_api.url_for_path("n/#{@namespace_id}/delta/generate_cursor")
|
64
|
+
path = @_api.url_for_path("/n/#{@namespace_id}/delta/generate_cursor")
|
65
65
|
data = { :start => timestamp }
|
66
66
|
|
67
67
|
cursor = nil
|
@@ -71,7 +71,7 @@ module Inbox
|
|
71
71
|
cursor = json["cursor"]
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
cursor
|
75
75
|
end
|
76
76
|
|
77
77
|
OBJECTS_TABLE = {
|
@@ -79,22 +79,19 @@ module Inbox
|
|
79
79
|
"calendar" => Inbox::Calendar,
|
80
80
|
"draft" => Inbox::Draft,
|
81
81
|
"thread" => Inbox::Thread,
|
82
|
-
"account" => Inbox::Account,
|
83
|
-
"calendar" => Inbox::Calendar,
|
84
82
|
"contact" => Inbox::Contact,
|
85
|
-
"draft" => Inbox::Draft,
|
86
83
|
"event" => Inbox::Event,
|
87
84
|
"file" => Inbox::File,
|
88
85
|
"message" => Inbox::Message,
|
89
86
|
"namespace" => Inbox::Namespace,
|
90
87
|
"tag" => Inbox::Tag,
|
91
|
-
"thread" => Inbox::Thread
|
92
88
|
}
|
93
89
|
|
94
90
|
def deltas(cursor, exclude_types=[])
|
91
|
+
raise 'Please provide a block for receiving the delta objects' if !block_given?
|
95
92
|
exclude_string = ""
|
96
93
|
|
97
|
-
if
|
94
|
+
if exclude_types.any?
|
98
95
|
exclude_string = "&exclude_types="
|
99
96
|
|
100
97
|
exclude_types.each do |value|
|
@@ -110,7 +107,7 @@ module Inbox
|
|
110
107
|
|
111
108
|
# loop and yield deltas until we've come to the end.
|
112
109
|
loop do
|
113
|
-
path = @_api.url_for_path("n/#{@namespace_id}/delta?cursor=#{cursor}#{exclude_string}")
|
110
|
+
path = @_api.url_for_path("/n/#{@namespace_id}/delta?cursor=#{cursor}#{exclude_string}")
|
114
111
|
json = nil
|
115
112
|
|
116
113
|
RestClient.get(path) do |response,request,result|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Gotow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|