inbox 0.15.4 → 0.15.7d
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -14
- data/lib/{thread.rb → api_thread.rb} +0 -0
- data/lib/event.rb +1 -1
- data/lib/inbox.rb +3 -1
- data/lib/namespace.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +46 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bf1a14939a06f0fd29cc70b8435546256973061
|
4
|
+
data.tar.gz: 81393fe2487ed39007e4ff631722ce0765362362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65fa4bcc531783cc0f467cd698a5dc923aa8cc1091cd8e91d4b7d676a79cf8273d074ec0977363d4de2d2d7337b663ad9af94f77aee9a7d1d64a52982f088875
|
7
|
+
data.tar.gz: e2b5131ab6bb1c527f24eaed1ba3ae283c94c412a7160c8e78806a2bac9eaf42b4625a296d2ca2444a6c5d457619b234fa6226f69ec9469458249fb7b911b2af
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ The Nylas REST API uses server-side (three-legged) OAuth, and the Ruby gem provi
|
|
51
51
|
require 'inbox'
|
52
52
|
|
53
53
|
def login
|
54
|
-
inbox =
|
54
|
+
inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
|
55
55
|
# The email address of the user you want to authenticate
|
56
56
|
user_email = 'ben@nylas.com'
|
57
57
|
|
@@ -66,7 +66,7 @@ end
|
|
66
66
|
|
67
67
|
```ruby
|
68
68
|
def login_callback
|
69
|
-
inbox =
|
69
|
+
inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
|
70
70
|
inbox_token = inbox.token_for_code(params[:code])
|
71
71
|
|
72
72
|
# Save the inbox_token to the current session, save it to the user model, etc.
|
@@ -89,7 +89,7 @@ pass the additional `trial: true` option to start their account in trial mode.
|
|
89
89
|
**Upgrading an Account**
|
90
90
|
|
91
91
|
```ruby
|
92
|
-
inbox =
|
92
|
+
inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
|
93
93
|
account = inbox.accounts.find(account_id)
|
94
94
|
account.upgrade!
|
95
95
|
```
|
@@ -97,7 +97,7 @@ pass the additional `trial: true` option to start their account in trial mode.
|
|
97
97
|
**Cancelling an Account**
|
98
98
|
|
99
99
|
```ruby
|
100
|
-
inbox =
|
100
|
+
inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
|
101
101
|
account = inbox.accounts.find(account_id)
|
102
102
|
account.downgrade!
|
103
103
|
|
@@ -108,7 +108,7 @@ pass the additional `trial: true` option to start their account in trial mode.
|
|
108
108
|
|
109
109
|
````ruby
|
110
110
|
# Query the status of every account linked to the app
|
111
|
-
inbox =
|
111
|
+
inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
|
112
112
|
accounts = inbox.accounts
|
113
113
|
accounts.each { |a| [a.account_id, a.sync_state] } # Available fields are: account_id, sync_state, trial, trial_expires, billing_state and namespace_id. See lib/account.rb for more details.
|
114
114
|
```
|
@@ -116,7 +116,7 @@ pass the additional `trial: true` option to start their account in trial mode.
|
|
116
116
|
### Fetching Namespaces
|
117
117
|
|
118
118
|
```ruby
|
119
|
-
inbox =
|
119
|
+
inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
|
120
120
|
|
121
121
|
# Get the first namespace
|
122
122
|
namespace = inbox.namespaces.first
|
@@ -276,9 +276,9 @@ cursor = inbox.namespaces.first.get_cursor(1407543195)
|
|
276
276
|
last_cursor = nil
|
277
277
|
inbox.namespaces.first.deltas(cursor) do |event, object|
|
278
278
|
if event == "create" or event == "modify"
|
279
|
-
if object.is_a?(
|
279
|
+
if object.is_a?(Nylas::Contact)
|
280
280
|
puts "#{object.name} - #{object.email}"
|
281
|
-
elsif object.is_a?(
|
281
|
+
elsif object.is_a?(Nylas::Event)
|
282
282
|
puts "Event!"
|
283
283
|
end
|
284
284
|
elsif event == "delete"
|
@@ -297,11 +297,11 @@ save_to_db(last_cursor)
|
|
297
297
|
|
298
298
|
### Exclude changes from a specific type --- get only messages
|
299
299
|
````ruby
|
300
|
-
inbox.namespaces.first.deltas(cursor, exclude=[
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
300
|
+
inbox.namespaces.first.deltas(cursor, exclude=[Nylas::Contact,
|
301
|
+
Nylas::Event,
|
302
|
+
Nylas::File,
|
303
|
+
Nylas::Tag,
|
304
|
+
Nylas::Thread]) do |event, object|
|
305
305
|
if event == 'create' or event == 'modify'
|
306
306
|
puts object.subject
|
307
307
|
end
|
@@ -335,7 +335,7 @@ The [Nylas Sync Engine](http://github.com/inboxapp/inbox) is open-source, and yo
|
|
335
335
|
|
336
336
|
```ruby
|
337
337
|
require 'inbox'
|
338
|
-
inbox =
|
338
|
+
inbox = Nylas::API.new(nil, nil, nil, 'http://localhost:5555/')
|
339
339
|
```
|
340
340
|
|
341
341
|
|
@@ -361,3 +361,11 @@ Test your new version (found in `pkg/`) locally, and then release with:
|
|
361
361
|
rake release
|
362
362
|
|
363
363
|
If it's your first time updating the ruby gem, you may be prompted for the username/password for rubygems.org. Members of the Nylas team can find that by doing `fetch-password rubygems`.
|
364
|
+
|
365
|
+
## OAuth self-test
|
366
|
+
|
367
|
+
Because it's very important that we don't break OAuth, we require releasers to run the OAuth self-test before releasing a version of the gem. The self-test is a small sinatra program which will ask you to click on a couple URLs. You need to make sure that following the URLs return a working token.
|
368
|
+
|
369
|
+
To set up the program, you need to copy `tests/credentials.rb.templates` as `test/credentials.rb` and edit the `APP_ID` and `APP_SECRET` with a working Nylas API app id and secret. You also need to set up a `/callback` URL in the Nylas admin panel.
|
370
|
+
|
371
|
+
You can then run the program using `cd tests && ruby -I../lib auth.rb`
|
File without changes
|
data/lib/event.rb
CHANGED
data/lib/inbox.rb
CHANGED
@@ -116,7 +116,7 @@ module Inbox
|
|
116
116
|
'code' => code
|
117
117
|
}
|
118
118
|
|
119
|
-
::RestClient.
|
119
|
+
::RestClient.post("https://#{@service_domain}/oauth/token", data) do |response, request, result|
|
120
120
|
json = Inbox.interpret_response(result, response, :expected_class => Object)
|
121
121
|
return json['access_token']
|
122
122
|
end
|
@@ -137,3 +137,5 @@ module Inbox
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
140
|
+
|
141
|
+
Nylas = Inbox.clone
|
data/lib/namespace.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,158 +1,172 @@
|
|
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.7d
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Gotow
|
8
|
+
- Karim Hamidou
|
9
|
+
- Jennie Lees
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date: 2015-05
|
13
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: rest-client
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '1.7'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- -
|
26
|
+
- - ~>
|
25
27
|
- !ruby/object:Gem::Version
|
26
28
|
version: '1.7'
|
27
29
|
- !ruby/object:Gem::Dependency
|
28
30
|
name: rspec
|
29
31
|
requirement: !ruby/object:Gem::Requirement
|
30
32
|
requirements:
|
31
|
-
- -
|
33
|
+
- - '>='
|
32
34
|
- !ruby/object:Gem::Version
|
33
35
|
version: '0'
|
34
36
|
type: :development
|
35
37
|
prerelease: false
|
36
38
|
version_requirements: !ruby/object:Gem::Requirement
|
37
39
|
requirements:
|
38
|
-
- -
|
40
|
+
- - '>='
|
39
41
|
- !ruby/object:Gem::Version
|
40
42
|
version: '0'
|
41
43
|
- !ruby/object:Gem::Dependency
|
42
44
|
name: shoulda
|
43
45
|
requirement: !ruby/object:Gem::Requirement
|
44
46
|
requirements:
|
45
|
-
- -
|
47
|
+
- - '>='
|
46
48
|
- !ruby/object:Gem::Version
|
47
49
|
version: '0'
|
48
50
|
type: :development
|
49
51
|
prerelease: false
|
50
52
|
version_requirements: !ruby/object:Gem::Requirement
|
51
53
|
requirements:
|
52
|
-
- -
|
54
|
+
- - '>='
|
53
55
|
- !ruby/object:Gem::Version
|
54
56
|
version: '0'
|
55
57
|
- !ruby/object:Gem::Dependency
|
56
58
|
name: rdoc
|
57
59
|
requirement: !ruby/object:Gem::Requirement
|
58
60
|
requirements:
|
59
|
-
- -
|
61
|
+
- - ~>
|
60
62
|
- !ruby/object:Gem::Version
|
61
63
|
version: '3.12'
|
62
64
|
type: :development
|
63
65
|
prerelease: false
|
64
66
|
version_requirements: !ruby/object:Gem::Requirement
|
65
67
|
requirements:
|
66
|
-
- -
|
68
|
+
- - ~>
|
67
69
|
- !ruby/object:Gem::Version
|
68
70
|
version: '3.12'
|
69
71
|
- !ruby/object:Gem::Dependency
|
70
72
|
name: bundler
|
71
73
|
requirement: !ruby/object:Gem::Requirement
|
72
74
|
requirements:
|
73
|
-
- -
|
75
|
+
- - '>='
|
74
76
|
- !ruby/object:Gem::Version
|
75
77
|
version: 1.3.5
|
76
78
|
type: :development
|
77
79
|
prerelease: false
|
78
80
|
version_requirements: !ruby/object:Gem::Requirement
|
79
81
|
requirements:
|
80
|
-
- -
|
82
|
+
- - '>='
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
version: 1.3.5
|
83
85
|
- !ruby/object:Gem::Dependency
|
84
86
|
name: jeweler
|
85
87
|
requirement: !ruby/object:Gem::Requirement
|
86
88
|
requirements:
|
87
|
-
- -
|
89
|
+
- - ~>
|
88
90
|
- !ruby/object:Gem::Version
|
89
91
|
version: 1.8.4
|
90
92
|
type: :development
|
91
93
|
prerelease: false
|
92
94
|
version_requirements: !ruby/object:Gem::Requirement
|
93
95
|
requirements:
|
94
|
-
- -
|
96
|
+
- - ~>
|
95
97
|
- !ruby/object:Gem::Version
|
96
98
|
version: 1.8.4
|
97
99
|
- !ruby/object:Gem::Dependency
|
98
100
|
name: pry
|
99
101
|
requirement: !ruby/object:Gem::Requirement
|
100
102
|
requirements:
|
101
|
-
- -
|
103
|
+
- - '>='
|
102
104
|
- !ruby/object:Gem::Version
|
103
105
|
version: '0'
|
104
106
|
type: :development
|
105
107
|
prerelease: false
|
106
108
|
version_requirements: !ruby/object:Gem::Requirement
|
107
109
|
requirements:
|
108
|
-
- -
|
110
|
+
- - '>='
|
109
111
|
- !ruby/object:Gem::Version
|
110
112
|
version: '0'
|
111
113
|
- !ruby/object:Gem::Dependency
|
112
114
|
name: pry-nav
|
113
115
|
requirement: !ruby/object:Gem::Requirement
|
114
116
|
requirements:
|
115
|
-
- -
|
117
|
+
- - '>='
|
116
118
|
- !ruby/object:Gem::Version
|
117
119
|
version: '0'
|
118
120
|
type: :development
|
119
121
|
prerelease: false
|
120
122
|
version_requirements: !ruby/object:Gem::Requirement
|
121
123
|
requirements:
|
122
|
-
- -
|
124
|
+
- - '>='
|
123
125
|
- !ruby/object:Gem::Version
|
124
126
|
version: '0'
|
125
127
|
- !ruby/object:Gem::Dependency
|
126
128
|
name: pry-stack_explorer
|
127
129
|
requirement: !ruby/object:Gem::Requirement
|
128
130
|
requirements:
|
129
|
-
- -
|
131
|
+
- - '>='
|
130
132
|
- !ruby/object:Gem::Version
|
131
133
|
version: '0'
|
132
134
|
type: :development
|
133
135
|
prerelease: false
|
134
136
|
version_requirements: !ruby/object:Gem::Requirement
|
135
137
|
requirements:
|
136
|
-
- -
|
138
|
+
- - '>='
|
137
139
|
- !ruby/object:Gem::Version
|
138
140
|
version: '0'
|
139
141
|
- !ruby/object:Gem::Dependency
|
140
142
|
name: webmock
|
141
143
|
requirement: !ruby/object:Gem::Requirement
|
142
144
|
requirements:
|
143
|
-
- -
|
145
|
+
- - '>='
|
144
146
|
- !ruby/object:Gem::Version
|
145
147
|
version: '0'
|
146
148
|
type: :development
|
147
149
|
prerelease: false
|
148
150
|
version_requirements: !ruby/object:Gem::Requirement
|
149
151
|
requirements:
|
150
|
-
- -
|
152
|
+
- - '>='
|
151
153
|
- !ruby/object:Gem::Version
|
152
154
|
version: '0'
|
153
|
-
|
154
|
-
|
155
|
-
|
155
|
+
- !ruby/object:Gem::Dependency
|
156
|
+
name: sinatra
|
157
|
+
requirement: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
type: :development
|
163
|
+
prerelease: false
|
164
|
+
version_requirements: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
description: Gem for interacting with the Inbox API.
|
156
170
|
email: ben@nylas.com
|
157
171
|
executables: []
|
158
172
|
extensions: []
|
@@ -160,9 +174,8 @@ extra_rdoc_files:
|
|
160
174
|
- LICENSE.txt
|
161
175
|
- README.md
|
162
176
|
files:
|
163
|
-
- LICENSE.txt
|
164
|
-
- README.md
|
165
177
|
- lib/account.rb
|
178
|
+
- lib/api_thread.rb
|
166
179
|
- lib/calendar.rb
|
167
180
|
- lib/contact.rb
|
168
181
|
- lib/draft.rb
|
@@ -176,9 +189,10 @@ files:
|
|
176
189
|
- lib/restful_model_collection.rb
|
177
190
|
- lib/rfc2882.rb
|
178
191
|
- lib/tag.rb
|
179
|
-
- lib/thread.rb
|
180
192
|
- lib/time_attr_accessor.rb
|
181
193
|
- lib/version.rb
|
194
|
+
- LICENSE.txt
|
195
|
+
- README.md
|
182
196
|
homepage: http://github.com/nylas/inbox-ruby
|
183
197
|
licenses:
|
184
198
|
- MIT
|
@@ -189,17 +203,17 @@ require_paths:
|
|
189
203
|
- lib
|
190
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
|
-
- -
|
206
|
+
- - '>='
|
193
207
|
- !ruby/object:Gem::Version
|
194
208
|
version: '0'
|
195
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
210
|
requirements:
|
197
|
-
- -
|
211
|
+
- - '>'
|
198
212
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
213
|
+
version: 1.3.1
|
200
214
|
requirements: []
|
201
215
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.
|
216
|
+
rubygems_version: 2.0.14
|
203
217
|
signing_key:
|
204
218
|
specification_version: 4
|
205
219
|
summary: Gem for interacting with the Inbox API
|