Skip to content

Ruby bindings for the Nylas Platform APIs (V2)

License

Notifications You must be signed in to change notification settings

nylas/nylas-ruby-legacy

 
 

Repository files navigation

Aimeos logo

Nylas Ruby SDK (Legacy/API v2)

This is the legacy version of the Nylas Ruby SDK, which supports the Nylas API v2. This version of the SDK is currently in maintenance mode and is supported for the purpose of assisting with migration to the new API v3. We recommend migrating and using the current Nylas Ruby SDK for the latest and greatest features.

⚙️ Install

Prerequisites

  • Ruby 2.3 or above.
  • Ruby Frameworks: rest-client, json, yajl-ruby.

We support Rails 4.2 and above. A more detailed compatibility list can be found in our list of Gemfiles.

Install

Add this line to your application's Gemfile:

gem 'nylas-legacy'

And then execute:

bundle

To run scripts that use the Nylas Ruby SDK, install the nylas gem.

gem install nylas-legacy

To install the SDK from source, clone this repo and install with bundle.

git clone https://github.com/nylas/nylas-ruby-legacy.git && cd nylas-ruby-legacy
bundle install

Setup Ruby SDK for Development

Install RubyGems if you don't already have it:

gem install bundler
gem update --system

Install the SDK from source

bundle install

You can run tests locally using rspec:

rspec spec

MacOS 10.11 (El Capitan) Note

Apple stopped bundling OpenSSL with MacOS 10.11. However, one of the dependencies of this gem (EventMachine) requires it. If you're on El Capitan and are unable to install the gem, try running the following commands in a terminal:

sudo brew install openssl
sudo brew link openssl --force
gem install nylas-legacy

⚡️ Usage

To use this SDK, you first need to sign up for a free Nylas developer account.

Then, follow our guide to setup your first app and get your API access keys.

All of the functionality of the Nylas Communications Platform is available through the API object. To access data for an account that’s connected to Nylas, create a new API client object and pass the variables you gathered when you got your developer API keys. In the following example, replace CLIENT_ID, CLIENT_SECRET, and ACCESS_TOKEN with your values.

require 'nylas-legacy'

nylas = NylasLegacy::API.new(
    app_id: CLIENT_ID,
    app_secret: CLIENT_SECRET,
    access_token: ACCESS_TOKEN
)

Now, you can use nylas to access full email, calendar, and contacts functionality. For example, here is how you would print the subject line for the most recent email message to the console.

message = nylas.messages.first
puts(message.subject)

To learn more about how to use the Nylas Ruby SDK, please refer to our Ruby SDK QuickStart Guide.

💙 Contributing

Please refer to Contributing for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.

Taking part in Hacktoberfest 2023 (i.e. issue is tagged with hacktoberfest)? Read our Nylas Hacktoberfest 2023 contribution guidelines.

📝 License

This project is licensed under the terms of the MIT license. Please refer to LICENSE for the full terms.

About

Ruby bindings for the Nylas Platform APIs (V2)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.5%
  • Other 0.5%