README.md in inbox-0.15.4 vs README.md in inbox-0.15.7d
- old
+ new
@@ -49,11 +49,11 @@
```ruby
require 'inbox'
def login
- inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
+ inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
# The email address of the user you want to authenticate
user_email = 'ben@nylas.com'
# This URL must be registered with your application in the developer portal
callback_url = url_for(:action => 'login_callback')
@@ -64,11 +64,11 @@
**Step 2: Handle the Authentication Response:**
```ruby
def login_callback
- inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
+ inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
inbox_token = inbox.token_for_code(params[:code])
# Save the inbox_token to the current session, save it to the user model, etc.
end
```
@@ -87,38 +87,38 @@
```
**Upgrading an Account**
```ruby
- inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
+ inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
account = inbox.accounts.find(account_id)
account.upgrade!
```
**Cancelling an Account**
```ruby
- inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
+ inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, nil)
account = inbox.accounts.find(account_id)
account.downgrade!
# Your Inbox API token will be revoked, you will not be charged
```
### Account Status
````ruby
# Query the status of every account linked to the app
- inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
+ inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
accounts = inbox.accounts
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.
```
### Fetching Namespaces
```ruby
-inbox = Inbox::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
+inbox = Nylas::API.new(config.inbox_app_id, config.inbox_app_secret, inbox_token)
# Get the first namespace
namespace = inbox.namespaces.first
# Print out the email address and provider (Gmail, Exchange)
@@ -274,13 +274,13 @@
cursor = inbox.namespaces.first.get_cursor(1407543195)
last_cursor = nil
inbox.namespaces.first.deltas(cursor) do |event, object|
if event == "create" or event == "modify"
- if object.is_a?(Inbox::Contact)
+ if object.is_a?(Nylas::Contact)
puts "#{object.name} - #{object.email}"
- elsif object.is_a?(Inbox::Event)
+ elsif object.is_a?(Nylas::Event)
puts "Event!"
end
elsif event == "delete"
# In the case of a deletion, the API only returns the ID of the object.
# In this case, the Ruby SDK returns a dummy object with only the id field
@@ -295,15 +295,15 @@
save_to_db(last_cursor)
```
### Exclude changes from a specific type --- get only messages
````ruby
-inbox.namespaces.first.deltas(cursor, exclude=[Inbox::Contact,
- Inbox::Event,
- Inbox::File,
- Inbox::Tag,
- Inbox::Thread]) do |event, object|
+inbox.namespaces.first.deltas(cursor, exclude=[Nylas::Contact,
+ Nylas::Event,
+ Nylas::File,
+ Nylas::Tag,
+ Nylas::Thread]) do |event, object|
if event == 'create' or event == 'modify'
puts object.subject
end
end
```
@@ -333,11 +333,11 @@
The [Nylas Sync Engine](http://github.com/inboxapp/inbox) is open-source, and you can also use the Ruby gem with the open-source API. Since the open-source API provides no authentication or security, connecting to it is simple. When you instantiate the Inbox object, provide `nil` for the App ID, App Secret, and API Token, and pass the fully-qualified address to your copy of the sync engine:
```ruby
require 'inbox'
-inbox = Inbox::API.new(nil, nil, nil, 'http://localhost:5555/')
+inbox = Nylas::API.new(nil, nil, nil, 'http://localhost:5555/')
```
## Contributing
@@ -359,5 +359,13 @@
Test your new version (found in `pkg/`) locally, and then release with:
rake release
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`.
+
+## OAuth self-test
+
+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.
+
+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.
+
+You can then run the program using `cd tests && ruby -I../lib auth.rb`