inbox 0.2.0 → 0.3.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 +7 -0
- data/Gemfile +18 -0
- data/LICENSE.txt +22 -0
- data/README.md +162 -74
- data/Rakefile +35 -30
- data/VERSION +1 -0
- data/example/.gitignore +16 -0
- data/example/Gemfile +39 -0
- data/example/README.rdoc +28 -0
- data/{test/dummy → example}/Rakefile +1 -2
- data/{app/views/inbox/emails/index.html.erb → example/app/assets/images/.keep} +0 -0
- data/example/app/assets/javascripts/application.js +16 -0
- data/example/app/assets/javascripts/welcome.js.coffee +3 -0
- data/example/app/assets/stylesheets/application.css +15 -0
- data/example/app/assets/stylesheets/welcome.css.scss +3 -0
- data/example/app/controllers/application_controller.rb +61 -0
- data/{test/dummy/db/development.sqlite3 → example/app/controllers/concerns/.keep} +0 -0
- data/{test/dummy → example}/app/helpers/application_helper.rb +0 -0
- data/example/app/helpers/welcome_helper.rb +2 -0
- data/{test/dummy/db/production.sqlite3 → example/app/mailers/.keep} +0 -0
- data/{test/dummy/db/test.sqlite3 → example/app/models/.keep} +0 -0
- data/{test/dummy/log/test.log → example/app/models/concerns/.keep} +0 -0
- data/example/app/views/layouts/application.html.erb +14 -0
- data/example/app/views/welcome/index.html.erb +2 -0
- data/example/bin/bundle +3 -0
- data/example/bin/rails +8 -0
- data/example/bin/rake +8 -0
- data/example/bin/spring +18 -0
- data/{test/dummy → example}/config.ru +1 -1
- data/example/config/application.rb +23 -0
- data/example/config/boot.rb +4 -0
- data/{test/dummy → example}/config/database.yml +8 -8
- data/example/config/environment.rb +5 -0
- data/example/config/environments/development.rb +39 -0
- data/example/config/environments/production.rb +82 -0
- data/example/config/environments/test.rb +41 -0
- data/example/config/initializers/assets.rb +8 -0
- data/{test/dummy → example}/config/initializers/backtrace_silencers.rb +1 -1
- data/example/config/initializers/cookies_serializer.rb +3 -0
- data/example/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/config/initializers/inflections.rb +16 -0
- data/{test/dummy → example}/config/initializers/mime_types.rb +0 -1
- data/example/config/initializers/session_store.rb +3 -0
- data/{test/dummy → example}/config/initializers/wrap_parameters.rb +6 -6
- data/example/config/locales/en.yml +23 -0
- data/example/config/routes.rb +59 -0
- data/example/config/secrets.yml +22 -0
- data/example/db/seeds.rb +7 -0
- data/{test/dummy/public/favicon.ico → example/lib/assets/.keep} +0 -0
- data/example/lib/tasks/.keep +0 -0
- data/example/log/.keep +0 -0
- data/example/public/404.html +67 -0
- data/example/public/422.html +67 -0
- data/example/public/500.html +66 -0
- data/example/public/favicon.ico +0 -0
- data/example/public/robots.txt +5 -0
- data/example/test/controllers/.keep +0 -0
- data/example/test/controllers/welcome_controller_test.rb +9 -0
- data/example/test/fixtures/.keep +0 -0
- data/example/test/fixtures/users.yml +11 -0
- data/example/test/helpers/.keep +0 -0
- data/example/test/helpers/welcome_helper_test.rb +4 -0
- data/example/test/integration/.keep +0 -0
- data/example/test/mailers/.keep +0 -0
- data/example/test/models/.keep +0 -0
- data/{test/integration/navigation_test.rb → example/test/models/user_test.rb} +1 -4
- data/example/test/test_helper.rb +10 -0
- data/example/vendor/assets/javascripts/.keep +0 -0
- data/example/vendor/assets/stylesheets/.keep +0 -0
- data/inbox.gemspec +327 -0
- data/lib/contact.rb +10 -0
- data/lib/draft.rb +28 -0
- data/lib/file.rb +31 -0
- data/lib/inbox.rb +81 -20
- data/lib/message.rb +37 -0
- data/lib/namespace.rb +51 -0
- data/lib/restful_model.rb +76 -0
- data/lib/restful_model_collection.rb +131 -0
- data/lib/tag.rb +9 -0
- data/lib/thread.rb +60 -0
- data/lib/version.rb +3 -0
- data/spec/inbox_spec.rb +79 -0
- data/spec/restful_model_spec.rb +18 -0
- data/spec/spec_helper.rb +1 -0
- data/tasks/rspec.rake +3 -0
- metadata +1038 -181
- data/MIT-LICENSE +0 -20
- data/app/assets/images/inbox/results_bg.png +0 -0
- data/app/assets/images/inbox/tree_bg.png +0 -0
- data/app/assets/javascripts/inbox/application.js +0 -8
- data/app/assets/javascripts/inbox/emails.js +0 -2
- data/app/assets/stylesheets/inbox/application.css +0 -7
- data/app/assets/stylesheets/inbox/emails.css +0 -59
- data/app/assets/stylesheets/inbox/panel.css.erb +0 -229
- data/app/assets/stylesheets/inbox/reset.css +0 -53
- data/app/controllers/inbox/application_controller.rb +0 -4
- data/app/controllers/inbox/emails_controller.rb +0 -52
- data/app/helpers/inbox/application_helper.rb +0 -4
- data/app/helpers/inbox/emails_helper.rb +0 -4
- data/app/mailers/inbox/email_mailer.rb +0 -11
- data/app/models/inbox/email.rb +0 -51
- data/app/views/inbox/emails/new.html.erb +0 -9
- data/app/views/inbox/emails/show.html.erb +0 -48
- data/app/views/layouts/inbox/application.html.erb +0 -15
- data/app/views/layouts/inbox/inbox.html.erb +0 -25
- data/config/routes.rb +0 -6
- data/lib/inbox/engine.rb +0 -9
- data/lib/inbox/version.rb +0 -3
- data/lib/tasks/inbox_tasks.rake +0 -4
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config/application.rb +0 -45
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -32
- data/test/dummy/config/environments/production.rb +0 -60
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/log/development.log +0 -3641
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/assets/C4D/8B0/sprockets%2F5e1b589842222e2ea0043890c2c84539 +0 -0
- data/test/dummy/tmp/cache/assets/C6F/5C0/sprockets%2F259fb59d511a70d46436201b6770a04a +0 -0
- data/test/dummy/tmp/cache/assets/CF2/F90/sprockets%2F5378bb2470df984ccf2643991a6e476d +0 -0
- data/test/dummy/tmp/cache/assets/D0B/330/sprockets%2F582a2b19d6be92a0393afa63894d721a +0 -0
- data/test/dummy/tmp/cache/assets/D1B/CE0/sprockets%2F09c9c18794df089e62443d3debb117e5 +0 -0
- data/test/dummy/tmp/cache/assets/D1D/BA0/sprockets%2F29888f599d35bb11e4a8183d6dc5e23a +0 -0
- data/test/dummy/tmp/cache/assets/D1F/600/sprockets%2Fdd3578c9bd0719efe092c59655a25c55 +0 -0
- data/test/dummy/tmp/cache/assets/D21/920/sprockets%2F85fd59fe11746a33f5f917a923d84be3 +0 -0
- data/test/dummy/tmp/cache/assets/D4D/FB0/sprockets%2Fd5743837e8babdab4825364c4ee86f73 +0 -0
- data/test/dummy/tmp/cache/assets/D4F/520/sprockets%2F88ecb483df9e177ee775202ba0691ec7 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/300/sprockets%2Fcc54b61039f74d6b8a2a7d04ad9d77f0 +0 -0
- data/test/dummy/tmp/cache/assets/D74/390/sprockets%2F5eda33e637dd54ff6a27bb76c482a473 +0 -0
- data/test/dummy/tmp/cache/assets/D76/170/sprockets%2Ffa5e461b362e11c80d5fd9e877fb63e2 +0 -0
- data/test/dummy/tmp/cache/assets/D7F/2D0/sprockets%2F141c2c9cb5235c8d21a00fbc8d7a2ab1 +0 -0
- data/test/dummy/tmp/cache/assets/D84/AA0/sprockets%2F5e841fe9d79e3ebf4333be8842b77bc5 +0 -0
- data/test/dummy/tmp/cache/assets/DA0/520/sprockets%2Fb8e93a54478c1f1a0e750ef2cbf74f3c +0 -0
- data/test/dummy/tmp/cache/assets/DC1/520/sprockets%2Feb8cea402f0bf04560adcd0cb8807b88 +0 -0
- data/test/dummy/tmp/mails/1345541756.4616725 +0 -11
- data/test/functional/inbox/email_test.rb +0 -9
- data/test/functional/inbox/emails_controller_test.rb +0 -16
- data/test/inbox_test.rb +0 -7
- data/test/test_helper.rb +0 -10
- data/test/unit/helpers/inbox/emails_helper_test.rb +0 -6
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: abe056c1b96943e3cddcb3b5ec95094ad07088f8
|
|
4
|
+
data.tar.gz: 71e10c1505539c294f862265799608ec30b839aa
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 36b4a7954a470d684038e56992795608fa244ca9a121b07b7d064aa60e76e689970ef270b34c7357a1c1bb21fb1aaeeb53ce5700dbfecd7bfd4e973c0b519a82
|
|
7
|
+
data.tar.gz: 42224c275e7beff0a84543729f49c82b102728599c5660a6132b91af541e4f0a78884dd286b55b98ccf1bde40156a39ca511ea62a5ed0d16df94b4e2fad3a300
|
data/Gemfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
gemspec
|
|
3
|
+
|
|
4
|
+
gem 'rest-client', '~> 1.6.8'
|
|
5
|
+
gem 'activesupport', '~> 4.1.4'
|
|
6
|
+
|
|
7
|
+
# Add dependencies to develop your gem here.
|
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
|
9
|
+
group :development, :test do
|
|
10
|
+
gem 'rspec'
|
|
11
|
+
gem "shoulda", ">= 0"
|
|
12
|
+
gem "rdoc", "~> 3.12"
|
|
13
|
+
gem "bundler", ">= 1.3.5"
|
|
14
|
+
gem "jeweler", "~> 1.8.4"
|
|
15
|
+
gem 'pry'
|
|
16
|
+
gem 'pry-nav'
|
|
17
|
+
gem 'pry-stack_explorer'
|
|
18
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
----
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2014 InboxApp, Inc. and Contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,126 +1,214 @@
|
|
|
1
|
-
Inbox
|
|
2
|
-
=====
|
|
1
|
+
# Inbox Ruby bindings
|
|
3
2
|
|
|
3
|
+
## Installation
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
-----------
|
|
5
|
+
Add this line to your application's Gemfile:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
gem 'inbox'
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
any other testing framework that you prefer.
|
|
9
|
+
And then execute:
|
|
12
10
|
|
|
11
|
+
bundle
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
------------
|
|
13
|
+
You don't need to use this repo unless you're planning to modify the gem. If you just want to use the Inbox SDK with Ruby bindings, you should run:
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
gem install inbox
|
|
18
16
|
|
|
19
|
-
```ruby
|
|
20
|
-
gem 'inbox'
|
|
21
|
-
```
|
|
22
17
|
|
|
23
|
-
|
|
18
|
+
##Requirements
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
- Ruby 1.8.7 or above. (Ruby 1.8.6 may work if you load ActiveSupport.)
|
|
21
|
+
|
|
22
|
+
- rest-client, json
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
A small example Rails app is included in the `example` directory. You can run the sample app to see how an authentication flow might be implemented.
|
|
28
|
+
|
|
29
|
+
`cd example`
|
|
28
30
|
|
|
31
|
+
`RESTCLIENT_LOG=stdout rails s`
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
-----
|
|
33
|
+
*Note that you will need to replace the Inbox App ID and Secret in `config/environments/development.rb` to use the sample app.*
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
## Usage
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
### App ID and Secret
|
|
38
|
+
|
|
39
|
+
Before you can interact with the Inbox API, you need to register for the Inbox developer program at [http://www.inboxapp.com/](http://www.inboxapp.com/). After you've created a developer account, you can create a new application to generate an App ID / Secret pair.
|
|
40
|
+
|
|
41
|
+
### Authentication
|
|
42
|
+
|
|
43
|
+
The Inbox API uses server-side (three-legged) OAuth, and the Ruby gem provides a convenience methods that simplify the OAuth process. For more information about authenticating with Inbox, visit the [Developer Documentation](https://www.inboxapp.com/docs/gettingstarted-hosted#authenticating).
|
|
44
|
+
|
|
45
|
+
**Step 1: Redirect the user to Inbox:**
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
:::ruby
|
|
49
|
+
require 'inbox'
|
|
50
|
+
|
|
51
|
+
def login
|
|
52
|
+
inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
|
|
53
|
+
# The email address of the user you want to authenticate
|
|
54
|
+
user_email = 'ben@inboxapp.com'
|
|
55
|
+
|
|
56
|
+
# This URL must be registered with your application in the developer portal
|
|
57
|
+
callback_url = url_for(:action => 'login_callback')
|
|
58
|
+
|
|
59
|
+
redirect_to inbox.url_for_authentication(callback_url, user_email)
|
|
38
60
|
end
|
|
39
61
|
```
|
|
40
62
|
|
|
41
|
-
|
|
42
|
-
if this one is already taken in your application
|
|
63
|
+
**Step 2: Handle the Authentication Response:**
|
|
43
64
|
|
|
44
|
-
```ruby
|
|
45
|
-
mount Inbox::Engine => "/mailer"
|
|
46
65
|
```
|
|
66
|
+
:::ruby
|
|
67
|
+
def login_callback
|
|
68
|
+
inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
|
|
69
|
+
inbox_token = inbox.auth_token_for_code(params[:code])
|
|
47
70
|
|
|
71
|
+
# Save the inbox_token to the current session, save it to the user model, etc.
|
|
72
|
+
end
|
|
73
|
+
```
|
|
48
74
|
|
|
49
|
-
|
|
50
|
-
-----
|
|
75
|
+
### Fetching Namespaces
|
|
51
76
|
|
|
52
|
-
|
|
77
|
+
```
|
|
78
|
+
:::ruby
|
|
79
|
+
inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
|
|
53
80
|
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
# Get the first namespace
|
|
82
|
+
namespace = inbox.namespaces.first
|
|
56
83
|
|
|
57
|
-
|
|
84
|
+
# Print out the email address and provider (Gmail, Exchange)
|
|
85
|
+
puts namespace.email_address
|
|
86
|
+
puts namespace.provider
|
|
87
|
+
```
|
|
58
88
|
|
|
59
|
-
### Testing framework
|
|
60
89
|
|
|
61
|
-
|
|
90
|
+
### Fetching Threads
|
|
62
91
|
|
|
63
|
-
```ruby
|
|
64
|
-
visit("/inbox/robert.pankowecki@gmail.com/emails")
|
|
65
|
-
click_link("Subject of the email")
|
|
66
|
-
has_content?("This should be in email")
|
|
67
|
-
click_link("Some link in the email ex. account activation link")
|
|
68
92
|
```
|
|
93
|
+
:::ruby
|
|
94
|
+
# Fetch the first thread
|
|
95
|
+
thread = namespace.threads.first
|
|
96
|
+
|
|
97
|
+
# Fetch a specific thread
|
|
98
|
+
thread = namespace.threads.find('ac123acd123ef123')
|
|
99
|
+
|
|
100
|
+
# List all threads tagged `inbox`
|
|
101
|
+
# (paginating 50 at a time until no more are returned.)
|
|
102
|
+
namespace.threads.where(:tag => 'inbox').each do |thread|
|
|
103
|
+
puts thread.subject
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# List the 5 most recent unread threads
|
|
107
|
+
namespace.threads.where(:tag => 'unread').range(0,4).each do |thread|
|
|
108
|
+
puts thread.subject
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# List all threads with 'ben@inboxapp.com'
|
|
112
|
+
namespace.threads.where(:any_email => 'ben@inboxapp.com').each do |thread|
|
|
113
|
+
puts thread.subject
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Collect all threads with 'ben@inboxapp.com' into an array.
|
|
117
|
+
# Note: for large numbers of threads, this is not advised.
|
|
118
|
+
threads = namespace.threads.where(:any_email => 'ben@inboxapp.com').all
|
|
119
|
+
```
|
|
120
|
+
|
|
69
121
|
|
|
70
|
-
|
|
71
|
-
your favorite testing framework (`BBQ`, `Capybara`, `Test::Unit`, `Spinach`, `Cucumber`, `RSpec`, whatever)
|
|
72
|
-
for checking the content of page. And you can reuse your matchers.
|
|
122
|
+
### Working with Threads
|
|
73
123
|
|
|
124
|
+
```
|
|
125
|
+
:::ruby
|
|
126
|
+
# List thread participants
|
|
127
|
+
thread.participants.each do |participant|
|
|
128
|
+
puts participant['email']
|
|
129
|
+
end
|
|
74
130
|
|
|
75
|
-
|
|
131
|
+
# Mark as read
|
|
132
|
+
thread.mark_as_read!
|
|
76
133
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
works fine.
|
|
134
|
+
# Archive
|
|
135
|
+
thread.archive!
|
|
80
136
|
|
|
81
|
-
|
|
137
|
+
# Add or remove arbitrary tags
|
|
138
|
+
tagsToAdd = ['inbox', 'cfa1233ef123acd12']
|
|
139
|
+
tagsToRemove = []
|
|
140
|
+
thread.update_tags!(tagsToAd, tagsToRemove)
|
|
82
141
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
142
|
+
# List messages
|
|
143
|
+
thread.messages.each do |message|
|
|
144
|
+
puts message.subject
|
|
145
|
+
end
|
|
86
146
|
```
|
|
87
147
|
|
|
88
|
-
Async (distributed / queue)
|
|
89
|
-
---------------------------
|
|
90
148
|
|
|
91
|
-
|
|
92
|
-
|
|
149
|
+
### Working with Files
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
:::ruby
|
|
153
|
+
# List files
|
|
154
|
+
namespace.files.each do |file|
|
|
155
|
+
puts file.filename
|
|
156
|
+
end
|
|
93
157
|
|
|
94
|
-
|
|
95
|
-
|
|
158
|
+
# Create a new file
|
|
159
|
+
file = namespace.files.build(:file => File.new("./public/favicon.ico", 'rb'))
|
|
160
|
+
file.save!
|
|
96
161
|
```
|
|
97
162
|
|
|
98
|
-
|
|
163
|
+
### Working with Messages, Contacts, etc.
|
|
164
|
+
|
|
165
|
+
Each of the primary collections (contacts, messages, etc.) behave the same way as `threads`. For example, finding messages with a filter is similar to finding threads:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
:::ruby
|
|
169
|
+
messages = namespace.messages.where(:to => 'ben@inboxapp.com`).all
|
|
170
|
+
```
|
|
99
171
|
|
|
172
|
+
The `where` method accepts a hash of filters, as documented in the [Inbox Filters Documentation](https://www.inboxapp.com/docs/api#filters).
|
|
100
173
|
|
|
101
|
-
|
|
174
|
+
### Creating and Sending Drafts
|
|
102
175
|
|
|
103
|
-
```ruby
|
|
104
|
-
config.action_mailer.delivery_method = :test
|
|
105
176
|
```
|
|
177
|
+
:::ruby
|
|
178
|
+
# Create a new draft
|
|
179
|
+
draft = namespace.drafts.build(
|
|
180
|
+
:to => [{:name => 'Ben Gotow', :email => 'ben@inboxapp.com'}],
|
|
181
|
+
:subject => "Sent by Ruby",
|
|
182
|
+
:body => "Hi there!<strong>This is HTML</strong>"
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
# Modify attributes as necessary
|
|
186
|
+
draft.cc = [{:name => 'Michael', :email => 'mg@inboxapp.com'}]
|
|
187
|
+
|
|
188
|
+
# Add the file we uploaded as an attachment
|
|
189
|
+
draft.attach(file)
|
|
190
|
+
|
|
191
|
+
# Save the draft
|
|
192
|
+
draft.save!
|
|
193
|
+
|
|
194
|
+
# Send the draft. This method returns immediately and queues the message
|
|
195
|
+
# with Inbox for delivery through the user's SMTP gateway.
|
|
196
|
+
draft.send!
|
|
197
|
+
```
|
|
198
|
+
|
|
106
199
|
|
|
200
|
+
## Contributing
|
|
107
201
|
|
|
108
|
-
|
|
109
|
-
-----------
|
|
202
|
+
We'd love your help making the Inbox ruby gem better. Join the Google Group for project updates and feature discussion. We also hang out in `##inbox` on [irc.freenode.net](http://irc.freenode.net), or you can email [help@inboxapp.com](mailto:help@inboxapp.com).
|
|
110
203
|
|
|
111
|
-
|
|
204
|
+
Please sign the Contributor License Agreement before submitting pull requests. (It's similar to other projects, like NodeJS or Meteor.)
|
|
112
205
|
|
|
206
|
+
The Inbox ruby gem uses [Jeweler](https://github.com/technicalpickles/jeweler) for release management. When you're ready to release a new version, do something like this:
|
|
113
207
|
|
|
114
|
-
|
|
115
|
-
|
|
208
|
+
rake version:bump:minor
|
|
209
|
+
rake release
|
|
116
210
|
|
|
117
|
-
|
|
118
|
-
* [https://github.com/ryanb/letter_opener](https://github.com/ryanb/letter_opener)
|
|
119
|
-
* [https://github.com/suhrawardi/capybara_email/](https://github.com/suhrawardi/capybara_email/)
|
|
120
|
-
* [https://github.com/pawelpacana/mail_inbox/](https://github.com/pawelpacana/mail_inbox/)
|
|
121
|
-
* [http://api.rubyonrails.org/](http://api.rubyonrails.org/)
|
|
211
|
+
Tests can be run with:
|
|
122
212
|
|
|
123
|
-
|
|
124
|
-
-------
|
|
213
|
+
rspec spec
|
|
125
214
|
|
|
126
|
-
MIT-LICENSE
|
data/Rakefile
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'bundler'
|
|
2
5
|
begin
|
|
3
|
-
|
|
4
|
-
rescue
|
|
5
|
-
puts
|
|
6
|
+
Bundler.setup(:default, :development)
|
|
7
|
+
rescue Bundler::BundlerError => e
|
|
8
|
+
$stderr.puts e.message
|
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
10
|
+
exit e.status_code
|
|
6
11
|
end
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
require 'rake'
|
|
13
|
+
|
|
14
|
+
require 'jeweler'
|
|
15
|
+
Jeweler::Tasks.new do |gem|
|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
|
+
gem.name = "inbox"
|
|
18
|
+
gem.homepage = "http://github.com/inboxapp/inbox-ruby"
|
|
19
|
+
gem.license = "MIT"
|
|
20
|
+
gem.summary = %Q{Gem for interacting with the Inbox API}
|
|
21
|
+
gem.description = %Q{Gem for interacting with the Inbox API that allows you to create and publish one-page websites, subscribe to web hooks and receive events when those pages are interacted with. Visit http://www.populr.me/ for more information. }
|
|
22
|
+
gem.email = "ben@inboxapp.com"
|
|
23
|
+
gem.authors = ["Ben Gotow"]
|
|
24
|
+
# dependencies defined in Gemfile
|
|
13
25
|
end
|
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
28
|
+
require 'rake/testtask'
|
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
|
30
|
+
test.libs << 'lib' << 'test'
|
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
|
32
|
+
test.verbose = true
|
|
21
33
|
end
|
|
22
34
|
|
|
23
|
-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
|
-
load 'rails/tasks/engine.rake'
|
|
25
|
-
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
require 'rdoc/task'
|
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
|
38
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
28
39
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
t.libs << 'test'
|
|
34
|
-
t.pattern = 'test/**/*_test.rb'
|
|
35
|
-
t.verbose = false
|
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
41
|
+
rdoc.title = "inbox #{version}"
|
|
42
|
+
rdoc.rdoc_files.include('README*')
|
|
43
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
36
44
|
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
task :default => :test
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.0
|
data/example/.gitignore
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config.
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore the default SQLite database.
|
|
11
|
+
/db/*.sqlite3
|
|
12
|
+
/db/*.sqlite3-journal
|
|
13
|
+
|
|
14
|
+
# Ignore all logfiles and tempfiles.
|
|
15
|
+
/log/*.log
|
|
16
|
+
/tmp
|
data/example/Gemfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
5
|
+
gem 'rails', '4.1.4'
|
|
6
|
+
# Use sqlite3 as the database for Active Record
|
|
7
|
+
gem 'sqlite3'
|
|
8
|
+
# Use SCSS for stylesheets
|
|
9
|
+
gem 'sass-rails', '~> 4.0.3'
|
|
10
|
+
# Use Uglifier as compressor for JavaScript assets
|
|
11
|
+
gem 'uglifier', '>= 1.3.0'
|
|
12
|
+
# Use CoffeeScript for .js.coffee assets and views
|
|
13
|
+
gem 'coffee-rails', '~> 4.0.0'
|
|
14
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
|
15
|
+
# gem 'therubyracer', platforms: :ruby
|
|
16
|
+
|
|
17
|
+
# Use jquery as the JavaScript library
|
|
18
|
+
gem 'jquery-rails'
|
|
19
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
20
|
+
gem 'turbolinks'
|
|
21
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
22
|
+
gem 'jbuilder', '~> 2.0'
|
|
23
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
|
24
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
|
25
|
+
|
|
26
|
+
gem 'inbox', :path => '../../'
|
|
27
|
+
|
|
28
|
+
# Use ActiveModel has_secure_password
|
|
29
|
+
# gem 'bcrypt', '~> 3.1.7'
|
|
30
|
+
|
|
31
|
+
# Use unicorn as the app server
|
|
32
|
+
# gem 'unicorn'
|
|
33
|
+
|
|
34
|
+
# Use Capistrano for deployment
|
|
35
|
+
# gem 'capistrano-rails', group: :development
|
|
36
|
+
|
|
37
|
+
# Use debugger
|
|
38
|
+
# gem 'debugger', group: [:development, :test]
|
|
39
|
+
|