inbox 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1accdd1e51e6151899d73c573098902b1ee46356
4
- data.tar.gz: ec98af89dabbfec85638a91a9fc436d97398db8e
3
+ metadata.gz: 4ce7bee1a5d8da871b749ca3e08f2d56ff8fbc83
4
+ data.tar.gz: d9697aa6dea6b53b5969f401349891da128c345a
5
5
  SHA512:
6
- metadata.gz: 736d52441c42352ff436525f3d3321baf5a29070f0c0571586b9359a98518da58afcf8aa07b8b7502484da5e57afe0749bf41d5f786c993a6e59572cc741e2a4
7
- data.tar.gz: 78dd66327d6fff5514fadc9258a0e7cc4ffdef0cc182744eeff77d2a684e75ce84022c838701a734b640590a793fe9f3b68382aabae6736084ca366444ca8eec
6
+ metadata.gz: 6476ec1777485f0316799a44ec7b705d98ccd0bbab65ebb9c9a5dc0ee8de3e0801eb5b1aca4eac476056972acfc495bfb1990fb627e840635def83b447739008
7
+ data.tar.gz: 18de191a67a571306a2eac90b053f50a58a2b79284f5be4833c8fb751d5a98618d18e5959d0f5cd41d8f1a24596f4a4ec50a23b7ecc01d66c22f758715abc971
data/README.md CHANGED
@@ -75,7 +75,7 @@ end
75
75
 
76
76
  ### Managing Billing
77
77
 
78
- If you're using the open-source version of the Inbox API or have fewer than 100 accounts associated with your developer app, you don't need to worry about billing. However, if you've requested production access to the Inbox API, you are billed monthly based on the number of email accounts you've connected to Inbox. You can choose to start accounts in "trial" state and sync slowly at a rate of one message per minute so users can try out your app. If you use trial mode, you need to upgrade accounts (and start paying for them) within 30 days or they will automatically expire. You may wish to upgrade accounts earlier to dramatically speed up the mail sync progress depending on your app's needs.
78
+ If you're using the open-source version of the Inbox API or have fewer than 10 accounts associated with your developer app, you don't need to worry about billing. However, if you've requested production access to the Inbox API, you are billed monthly based on the number of email accounts you've connected to Inbox. You can choose to start accounts in "trial" state and sync slowly at a rate of one message per minute so users can try out your app. If you use trial mode, you need to upgrade accounts (and start paying for them) within 30 days or they will automatically expire. You may wish to upgrade accounts earlier to dramatically speed up the mail sync progress depending on your app's needs.
79
79
 
80
80
  **Starting an Account in Trial Mode**
81
81
 
@@ -198,6 +198,15 @@ messages = namespace.messages.where(:to => 'ben@inboxapp.com`).all
198
198
 
199
199
  The `where` method accepts a hash of filters, as documented in the [Inbox Filters Documentation](https://www.inboxapp.com/docs/api#filters).
200
200
 
201
+ ### Getting the raw contents of a message
202
+
203
+ It's possible to access the unprocessed contents of a message using the raw method:
204
+
205
+ ```ruby
206
+ raw_contents = message.raw.rfc2822
207
+ ```
208
+
209
+
201
210
  ### Creating and Sending Drafts
202
211
 
203
212
  ```ruby
data/lib/inbox.rb CHANGED
@@ -57,7 +57,7 @@ module Inbox
57
57
  end
58
58
 
59
59
  def url_for_path(path)
60
- raise NoAuthToken.new if @access_token == nil
60
+ raise NoAuthToken.new if @access_token == nil and (@app_secret != nil or @app_id != nil)
61
61
  protocol, domain = @api_server.split('//')
62
62
  "#{protocol}//#{@access_token}:@#{domain}#{path}"
63
63
  end
data/lib/message.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'restful_model'
2
2
  require 'file'
3
+ require 'rfc2882'
3
4
 
4
5
  module Inbox
5
6
  class Message < RestfulModel
@@ -28,5 +29,15 @@ module Inbox
28
29
  @files ||= RestfulModelCollection.new(File, @_api, @namespace_id, {:message_id=>@id})
29
30
  end
30
31
 
32
+ def raw
33
+ model = nil
34
+ collection = RestfulModelCollection.new(Message, @_api, @namespace_id, {:message_id=>@id})
35
+ RestClient.get("#{collection.url}/#{id}/rfc2822"){ |response,request,result|
36
+ json = Inbox.interpret_response(result, response, {:expected_class => Object})
37
+ model = Rfc2822.new(@_api)
38
+ model.inflate(json)
39
+ }
40
+ model
41
+ end
31
42
  end
32
- end
43
+ end
@@ -94,13 +94,13 @@ module Inbox
94
94
  models
95
95
  end
96
96
 
97
- private
98
-
99
97
  def url
100
98
  prefix = "/n/#{@namespace_id}" if @namespace_id
101
99
  @_api.url_for_path("#{prefix}/#{@model_class.collection_name}")
102
100
  end
103
101
 
102
+ private
103
+
104
104
  def get_model(id)
105
105
  model = nil
106
106
 
@@ -130,4 +130,4 @@ module Inbox
130
130
  end
131
131
 
132
132
  end
133
- end
133
+ end
data/lib/rfc2882.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'base64'
2
+ require 'restful_model'
3
+
4
+ module Inbox
5
+ class Rfc2822 < RestfulModel
6
+
7
+ parameter :rfc2822
8
+
9
+ def inflate(json)
10
+ super
11
+ # The 'rfc2822' attribute is a base64-encoded string. Decode it.
12
+ @rfc2822 = Base64.decode64(@rfc2822) if json.has_key?('rfc2822')
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Gotow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.7'
20
20
  type: :runtime
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: '1.6'
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: shoulda
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rdoc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.12'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.12'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.3.5
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.3.5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: jeweler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.8.4
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.8.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry-nav
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry-stack_explorer
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: 'Gem for interacting with the Inbox API that allows you to create and
@@ -146,6 +146,8 @@ extra_rdoc_files:
146
146
  - LICENSE.txt
147
147
  - README.md
148
148
  files:
149
+ - LICENSE.txt
150
+ - README.md
149
151
  - lib/calendar.rb
150
152
  - lib/contact.rb
151
153
  - lib/draft.rb
@@ -157,12 +159,11 @@ files:
157
159
  - lib/parameters.rb
158
160
  - lib/restful_model.rb
159
161
  - lib/restful_model_collection.rb
162
+ - lib/rfc2882.rb
160
163
  - lib/tag.rb
161
164
  - lib/thread.rb
162
165
  - lib/time_attr_accessor.rb
163
166
  - lib/version.rb
164
- - LICENSE.txt
165
- - README.md
166
167
  homepage: http://github.com/inboxapp/inbox-ruby
167
168
  licenses:
168
169
  - MIT
@@ -173,17 +174,17 @@ require_paths:
173
174
  - lib
174
175
  required_ruby_version: !ruby/object:Gem::Requirement
175
176
  requirements:
176
- - - '>='
177
+ - - ">="
177
178
  - !ruby/object:Gem::Version
178
179
  version: '0'
179
180
  required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  requirements:
181
- - - '>='
182
+ - - ">="
182
183
  - !ruby/object:Gem::Version
183
184
  version: '0'
184
185
  requirements: []
185
186
  rubyforge_project:
186
- rubygems_version: 2.0.14
187
+ rubygems_version: 2.2.2
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: Gem for interacting with the Inbox API