Skip to content

Commit

Permalink
Renaming All Nylas Constants to NylasV2
Browse files Browse the repository at this point in the history
  • Loading branch information
PickertJoe committed May 24, 2024
1 parent fa7797d commit 4879803
Show file tree
Hide file tree
Showing 161 changed files with 620 additions and 620 deletions.
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* Add Outbox support
* Add new `authentication_type` field in Account
* Add support for basic authentication
* Enable Nylas API v2.5 support
* Enable NylasV2 API v2.5 support

### 5.8.0 / 2022-03-18
* Improved support for `Webhook` objects
Expand Down Expand Up @@ -82,7 +82,7 @@
### 5.3.0 / 2021-08-18
* Add support for Neural API
* Fix issue where `Delta` did not have a header attribute for expanded headers
* Fix ArgumentError when calling `Nylas::API#send!` due to missing double splat (**)
* Fix ArgumentError when calling `NylasV2::API#send!` due to missing double splat (**)
* Fix issue where server errors are not reported if HTML is returned
* Fix issue where expanded `Thread` objects were not returning messages

Expand All @@ -103,7 +103,7 @@

### 5.0.0 / 2021-05-07

* Send `Nylas-API-Version` header to API with latest supported version.
* Send `NylasV2-API-Version` header to API with latest supported version.
* Fix issue sending message using raw mime type.
* Support for `messages.expanded.find(id)` to return expanded message.
* Add support for hosted authentication
Expand Down Expand Up @@ -163,7 +163,7 @@
* Fix issue when calling `.save` on `message` (https://github.com/nylas/nylas-ruby/pull/233)
* Add support for Rails 6.
* Fix issue for updating `message` with sending `label_ids` (https://github.com/nylas/nylas-ruby/pull/231)
* Support for `when` in `Nylas::Event` for more attributes.
* Support for `when` in `NylasV2::Event` for more attributes.
* Add internal transfer api to support initialize related objects.
* Fix encoding issues when downloading attachments.

Expand All @@ -183,10 +183,10 @@

* Drop support for Ruby 2.2 and 2.3: they have reached end-of-life
* Add support for Ruby 2.5 and 2.6
* Add `scopes` argument to `Nylas::API#authenticate` for
* Add `scopes` argument to `NylasV2::API#authenticate` for
[selective sync](https://docs.nylas.com/docs/how-to-use-selective-sync)
* Add `Account#revoke_all`
* Add X-Nylas-Client-Id header for HTTP requests
* Add X-NylasV2-Client-Id header for HTTP requests

### 4.2.4 / 2018-08-07
* Enables silent addition of fields to API without impact to SDK
Expand Down Expand Up @@ -240,7 +240,7 @@

* Deprecate the tags API
* Remove the archive!/unarchive! methods
* Expose `starred`, `unread`, `has_attachments` in Nylas::Thread
* Expose `starred`, `unread`, `has_attachments` in NylasV2::Thread

[full changelog](https://github.com/nylas/nylas-ruby/compare/v1.2.1...v1.3.0)

Expand Down
6 changes: 3 additions & 3 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Contribute to Nylas
# Contribute to NylasV2
👍 🎉 First of all, thanks for taking the time to contribute! 🎉 👍

The following is a set of guidelines for contributing to the Nylas Ruby SDK; these are guidelines, not rules, so please use your best judgement and feel free to propose changes to this document via pull request.
The following is a set of guidelines for contributing to the NylasV2 Ruby SDK; these are guidelines, not rules, so please use your best judgement and feel free to propose changes to this document via pull request.

# How to Ask a Question

If you have a question about how to use the Ruby SDK, please [create an issue](https://github.com/nylas/nylas-ruby/issues) and label it as a question. If you have more general questions about the Nylas Communications Platform, or the Nylas Email, Calendar, and Contacts API, please reach out to [email protected] to get help.
If you have a question about how to use the Ruby SDK, please [create an issue](https://github.com/nylas/nylas-ruby/issues) and label it as a question. If you have more general questions about the NylasV2 Communications Platform, or the NylasV2 Email, Calendar, and Contacts API, please reach out to [email protected] to get help.

# How To Contribute
## Report a Bug or Request a Feature
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
----

Copyright (c) 2016 Nylas, Inc. and Contributors
Copyright (c) 2016 NylasV2, Inc. and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<a href="https://www.nylas.com/">
<img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" />
<img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/NylasV2-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" />
</a>

# Nylas Ruby SDK
# NylasV2 Ruby SDK

[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/nylas/nylas-ruby/CI)](https://github.com/nylas/nylas-ruby/actions/workflows/rspec.yml)
[![codecov](https://codecov.io/gh/nylas/nylas-ruby/branch/main/graph/badge.svg?token=IKH0YMH4KA)](https://codecov.io/gh/nylas/nylas-ruby)

The Nylas Communications Platform allows developers to quickly build features that connect to every inbox, calendar, and contacts book in the world. Nylas makes it easy to build an integration that can be completed in days, and provides pre-built security and compliance features, and a 99.9% guaranteed uptime. Integrations with the Nylas Communications Platform are secure, reliable, and easy to use and maintain.
The NylasV2 Communications Platform allows developers to quickly build features that connect to every inbox, calendar, and contacts book in the world. NylasV2 makes it easy to build an integration that can be completed in days, and provides pre-built security and compliance features, and a 99.9% guaranteed uptime. Integrations with the NylasV2 Communications Platform are secure, reliable, and easy to use and maintain.

Nylas provides REST APIs for [Email](https://docs.nylas.com/docs/quickstart-email), [Calendar](https://docs.nylas.com/docs/quickstart-calendar), and [Contacts](https://docs.nylas.com/docs/quickstart-contacts), and the Ruby SDK is the quickest way to build your first integration using Ruby.
NylasV2 provides REST APIs for [Email](https://docs.nylas.com/docs/quickstart-email), [Calendar](https://docs.nylas.com/docs/quickstart-calendar), and [Contacts](https://docs.nylas.com/docs/quickstart-contacts), and the Ruby SDK is the quickest way to build your first integration using Ruby.

This is the GitHub repository for the Nylas Ruby SDK and is primarily for anyone who wants to make contributions to the SDK or install it from source. If you are looking to use Ruby to access the Nylas Email, Calendar, or Contacts API you should refer to our official [Ruby](https://docs.nylas.com/docs/quickstart-ruby) [SDK Quickstart Guide](https://docs.nylas.com/docs/quickstart-ruby).
This is the GitHub repository for the NylasV2 Ruby SDK and is primarily for anyone who wants to make contributions to the SDK or install it from source. If you are looking to use Ruby to access the NylasV2 Email, Calendar, or Contacts API you should refer to our official [Ruby](https://docs.nylas.com/docs/quickstart-ruby) [SDK Quickstart Guide](https://docs.nylas.com/docs/quickstart-ruby).

Here are some additional resources to help you get started:

- [Nylas SDK Tutorials](https://docs.nylas.com/docs/tutorials)
- [Get Started with the Nylas Communications Platform](https://docs.nylas.com/docs/getting-started)
- [Sign up for your Nylas developer account.](https://nylas.com/register)
- [Nylas API Reference](https://docs.nylas.com/reference)
- [NylasV2 SDK Tutorials](https://docs.nylas.com/docs/tutorials)
- [Get Started with the NylasV2 Communications Platform](https://docs.nylas.com/docs/getting-started)
- [Sign up for your NylasV2 developer account.](https://nylas.com/register)
- [NylasV2 API Reference](https://docs.nylas.com/reference)

If you have a question that needs an answer, please reach out to [email protected] to get help.

Expand All @@ -43,7 +43,7 @@ And then execute:
bundle
```

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

```bash
gem install nylas
Expand Down Expand Up @@ -89,17 +89,17 @@ gem install nylas

## ⚡️ Usage

To use this SDK, you first need to [sign up for a free Nylas developer account](https://nylas.com/register).
To use this SDK, you first need to [sign up for a free NylasV2 developer account](https://nylas.com/register).

Then, follow our guide to [setup your first app and get your API access keys](https://docs.nylas.com/docs/get-your-developer-api-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.
All of the functionality of the NylasV2 Communications Platform is available through the `API` object. To access data for an account that’s connected to NylasV2, 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.


```ruby
require 'nylas'

nylas = Nylas::API.new(
nylas = NylasV2::API.new(
app_id: CLIENT_ID,
app_secret: CLIENT_SECRET,
access_token: ACCESS_TOKEN
Expand All @@ -114,7 +114,7 @@ message = nylas.messages.first
puts(message.subject)
```

To learn more about how to use the Nylas Ruby SDK, please refer to our [Ruby](https://docs.nylas.com/docs/quickstart-ruby) [SDK QuickStart Guide](https://docs.nylas.com/docs/quickstart-ruby).
To learn more about how to use the NylasV2 Ruby SDK, please refer to our [Ruby](https://docs.nylas.com/docs/quickstart-ruby) [SDK QuickStart Guide](https://docs.nylas.com/docs/quickstart-ruby).

## 💙 Contributing

Expand Down
2 changes: 1 addition & 1 deletion bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

bin/test
SDK_VERSION=`ruby -e "require './lib/nylas/version' ; puts Nylas::VERSION"`
SDK_VERSION=`ruby -e "require './lib/nylas/version' ; puts NylasV2::VERSION"`
echo "Going to release version $SDK_VERSION of the SDK!"

gem build nylas.gemspec
Expand Down
10 changes: 5 additions & 5 deletions examples/authentication/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Authentication

Nylas supports two forms of authentication:
NylasV2 supports two forms of authentication:

* Native Authentication, where the developer is responsible for building the user interface for retrieiving the appropriate credentials for a users contacts, mail and/or calendar provider. See the [Nylas Native Authentication Reference Documentation](https://docs.nylas.com/reference#native-authentication-1) for more details.
* Native Authentication, where the developer is responsible for building the user interface for retrieiving the appropriate credentials for a users contacts, mail and/or calendar provider. See the [NylasV2 Native Authentication Reference Documentation](https://docs.nylas.com/reference#native-authentication-1) for more details.

* Nylas OAuth, where Nylas acts as an OAuth Provider that abstracts away the supported providers. This allows you to get up and running quickly without having to build potentially complex user interfaces for supporting any number of providers. See the [Nylas OAuth Authentication Reference Documentation](https://docs.nylas.com/reference#oauth) for more details.
* NylasV2 OAuth, where NylasV2 acts as an OAuth Provider that abstracts away the supported providers. This allows you to get up and running quickly without having to build potentially complex user interfaces for supporting any number of providers. See the [NylasV2 OAuth Authentication Reference Documentation](https://docs.nylas.com/reference#oauth) for more details.

## Running the Example

1. Clone the repository
1. Install the dependencies by using `bundle install`
1. Get a Nylas App ID and App Secret from the [Nylas Dashboard](https://dashboard.nylas.com/)
1. Get a Google Cloud Platform Access Token by following the [Nylas Google Setup Guide](https://docs.nylas.com/docs/creating-a-google-project-for-dev). Make sure to set the callback to `localhost:4567/auth/google/callback`.
1. Get a NylasV2 App ID and App Secret from the [NylasV2 Dashboard](https://dashboard.nylas.com/)
1. Get a Google Cloud Platform Access Token by following the [NylasV2 Google Setup Guide](https://docs.nylas.com/docs/creating-a-google-project-for-dev). Make sure to set the callback to `localhost:4567/auth/google/callback`.
1. Copy `.env.example` to `.env` and set the values based upon the previous steps.
1. Run the app web server: `bundle exec dotenv ruby app.rb`
1. Login to whichever mail, contact, and calendaring providers you want using the different authentication mechanisms.
2 changes: 1 addition & 1 deletion examples/authentication/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
send(method, "/auth/:provider/callback") do
auth_hash = env['omniauth.auth'] # => OmniAuth::AuthHash

api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'])
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'])
nylas_token = api.authenticate(name: auth_hash[:info][:name], email_address: auth_hash[:info][:email],
provider: :gmail,
settings: { google_client_id: ENV['GOOGLE_CLIENT_ID'],
Expand Down
2 changes: 1 addition & 1 deletion examples/listening-for-webhooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ then as the particular data as a hash

1. Clone the repository
1. Install the dependencies by using `bundle install`
1. Get a Nylas App ID and App Secret from the [Nylas Dashboard](https://dashboard.nylas.com/)
1. Get a NylasV2 App ID and App Secret from the [NylasV2 Dashboard](https://dashboard.nylas.com/)
1. Run the app web server: `bundle exec ruby demo-app.rb`
1. Use a service like `ngrok` to expose your local app server to the public internet.
1. Set up a webhook to point to the public url for your local instance at the path `/webhook-event-received` by following the [instructions for creating a webhook](https://docs.nylas.com/v1.0/reference#creating-a-webhook).
Expand Down
2 changes: 1 addition & 1 deletion examples/listening-for-webhooks/demo-app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
json = request.body.read
logger.info ["json", json]
data = JSON.parse(json, symbolize_names: true)
deltas = Nylas::Deltas.new(**data)
deltas = NylasV2::Deltas.new(**data)
deltas.map do |delta|
logger.info ["delta", delta.to_h]
logger.info ["instance", delta.instance.class, delta.instance.to_h]
Expand Down
6 changes: 3 additions & 3 deletions examples/plain-ruby/accounts.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the API. It
# follows the rough structure of the [Nylas API Reference](https://docs.nylas.com/reference).
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the API. It
# follows the rough structure of the [NylasV2 API Reference](https://docs.nylas.com/reference).
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])

# Retrieving the account information for given access token
Expand Down
4 changes: 2 additions & 2 deletions examples/plain-ruby/calendars.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the Nylas
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the NylasV2
# Calendar API.
# See https://docs.nylas.com/reference#calendars
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])


Expand Down
6 changes: 3 additions & 3 deletions examples/plain-ruby/components.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the API. It
# follows the rough structure of the [Nylas API Reference](https://docs.nylas.com/reference).
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'])
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the API. It
# follows the rough structure of the [NylasV2 API Reference](https://docs.nylas.com/reference).
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'])

# Create a component
# NOTE: you will need to set the account_id and the access_token
Expand Down
8 changes: 4 additions & 4 deletions examples/plain-ruby/contacts.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../helpers'
# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the API. It
# follows the rough structure of the [Nylas API Reference](https://docs.nylas.com/reference).
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the API. It
# follows the rough structure of the [NylasV2 API Reference](https://docs.nylas.com/reference).
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])
# Retrieving a count of contacts
demonstrate { api.contacts.count }
Expand Down Expand Up @@ -66,7 +66,7 @@
demonstrate { contact_with_picture.picture_url }
begin
demonstrate { contact_with_picture.picture }
rescue Nylas::ResourceNotFound
rescue NylasV2::ResourceNotFound
puts "That contacts picture didn't propagate yet :/"
end

Expand Down
6 changes: 3 additions & 3 deletions examples/plain-ruby/deltas.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the Nylas #
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the NylasV2 #
# Deltas API.
# See https://docs.nylas.com/reference#deltas
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])


Expand All @@ -27,7 +27,7 @@
# 5 delta's
demonstrate { deltas_from_cursor.take(5).map(&:to_h) }

# Models are cast to Nylas::Model objects
# Models are cast to NylasV2::Model objects
demonstrate { deltas_from_cursor.first&.model&.class }

# And can be viewed directly
Expand Down
4 changes: 2 additions & 2 deletions examples/plain-ruby/drafts.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the Nylas
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the NylasV2
# Drafts API. See https://docs.nylas.com/reference#drafts for API documentation
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])

# Creating a draft
Expand Down
4 changes: 2 additions & 2 deletions examples/plain-ruby/events.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the Nylas
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the NylasV2
# Events API.
# See https://docs.nylas.com/reference#events
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])

# Counting the events
Expand Down
4 changes: 2 additions & 2 deletions examples/plain-ruby/files.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require_relative '../helpers'

# An executable specification that demonstrates how to use the Nylas Ruby SDK to interact with the Nylas Files
# An executable specification that demonstrates how to use the NylasV2 Ruby SDK to interact with the NylasV2 Files
# API.
# See https://docs.nylas.com/reference#files
api = Nylas::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
api = NylasV2::API.new(app_id: ENV['NYLAS_APP_ID'], app_secret: ENV['NYLAS_APP_SECRET'],
access_token: ENV['NYLAS_ACCESS_TOKEN'])

# Listing files
Expand Down
Loading

0 comments on commit 4879803

Please sign in to comment.