Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[73525] Metadata Support for Calendars, Accounts, and Messages #337

Conversation

mrashed-dev
Copy link
Contributor

Description

The metadata feature first introduced for events has expended to Calendar, Message and Account. This PR adds support for this change. More information on the expansion of the metadata can be found here: https://developer.nylas.com/docs/developer-tools/api/metadata

Usage

Adding Metadata to Calendar

api.calendars.create(
  name: "My New Calendar",
  description: "Description of my new calendar",
  location: "Location description",
  timezone: "America/Los_Angeles",
  metadata: {
    event_type: "gathering"
  }
)

# Or you can update a calendar with metadata

calendar = api.calendars.last

calendar.update(metadata: {
  test: "true",
}};

Query Calendars by Metadata

calendars = api.calendars.where(metadata_pair: {event_type: "gathering"})

Adding Metadata to Message

message = api.messages.last

message.update(metadata: {
  test: "true",
}};

Query Messages by Metadata

messages = api.messages.where({metadata_key: "test"});

Adding Metadata to Account

account = api.current_account

account.update(metadata: {
  test: "true",
}};

Query Account by Metadata

accounts = api.accounts.where({metadata_key: "test"});

License

I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #73525: Ruby SDK Support for Metadata feature expansion.

Copy link
Contributor

@dtom90 dtom90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@mrashed-dev mrashed-dev merged commit a19b1bf into main Nov 22, 2021
@mrashed-dev mrashed-dev deleted the mostafarashed/sc-73525/ruby-sdk-support-for-metadata-feature-expansion branch November 22, 2021 18:54
@mrashed-dev mrashed-dev mentioned this pull request Nov 22, 2021
mrashed-dev added a commit that referenced this pull request Dec 13, 2021
This PR builds on #337, the API also supports adding metadata to a message either via adding to a Draft or sending directly through /send. Now both the NewMessage and Draft objects support metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants