nylas 5.15.0 → 5.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b432f464fcd9fec327a4aa014c499cadcf34aa8c4626ae1585d32b4aff9c7b21
4
- data.tar.gz: 5c62a00ba6e2f1de70346aa7fe4cdb7d7a129c6b91c76a35c6349e9597ab51c0
3
+ metadata.gz: 0660c04f6656d846a55819153819877b599ed5342d8f2ea9c18a7b19e0799ec3
4
+ data.tar.gz: bf1bd6d4382a6705a5146ff86202436512cf0fc5c68817c77a932e846c3150cf
5
5
  SHA512:
6
- metadata.gz: 5220e063570324c94c8baf4e01645017510e497619382e2f872f110d9fbfa9f7c454b50bd87098382f0339cb6da2208eb45e3e6b622c92db330c978a85887f5e
7
- data.tar.gz: 0e9388e8c5b7931212bbcdc1b21d324b4025634665aff3a3c3be7bf08f823d08c9b2b820d203287e4dfabaf3b95737a070cc8cb6957b86b80f0dd45dc5e3711d
6
+ metadata.gz: 076702b69e4ea6a7ef882f3ac65490d54c90bae69cdc8f940aab62a4d29997627d7936b3426158e10935f1aecfad517e17b2d3c5502aa26a636e48319c492fcd
7
+ data.tar.gz: 1d7fd956e5676c2b418ed2d0d79ecfd9cf3b6a961f8768ee0dd97952f0ea043810e90499063b1940efc055506a79187f78d4daf04fe386dfbdf64141bd1d9262
data/lib/nylas/api.rb CHANGED
@@ -24,14 +24,16 @@ module Nylas
24
24
  end
25
25
 
26
26
  # @return [String] A Nylas access token for that particular user.
27
- def authenticate(name:, email_address:, provider:, settings:, reauth_account_id: nil, scopes: nil)
27
+ def authenticate(name:, email_address:, provider:, settings:, reauth_account_id: nil, scopes: nil,
28
+ return_full_response: false)
28
29
  NativeAuthentication.new(api: self).authenticate(
29
30
  name: name,
30
31
  email_address: email_address,
31
32
  provider: provider,
32
33
  settings: settings,
33
34
  reauth_account_id: reauth_account_id,
34
- scopes: scopes
35
+ scopes: scopes,
36
+ return_full_response: return_full_response
35
37
  )
36
38
  end
37
39
 
data/lib/nylas/event.rb CHANGED
@@ -40,10 +40,13 @@ module Nylas
40
40
  has_n_of_attribute :notifications, :event_notification
41
41
  has_n_of_attribute :round_robin_order, :string
42
42
  attribute :original_start_time, :unix_timestamp
43
+ attribute :organizer_email, :string
44
+ attribute :organizer_name, :string
43
45
  attribute :reminder_minutes, :string
44
46
  attribute :reminder_method, :string
45
47
  attribute :job_status_id, :string, read_only: true
46
48
  attribute :visibility, :string
49
+ attribute :updated_at, :unix_timestamp, read_only: true
47
50
 
48
51
  attr_accessor :notify_participants
49
52
 
data/lib/nylas/label.rb CHANGED
@@ -17,11 +17,11 @@ module Nylas
17
17
 
18
18
  attribute :id, :string
19
19
  attribute :account_id, :string
20
-
21
20
  attribute :object, :string
22
21
 
23
22
  attribute :name, :string
24
23
  attribute :display_name, :string
24
+ attribute :provider_id, :string
25
25
  attribute :job_status_id, :string, read_only: true
26
26
  end
27
27
  end
@@ -11,13 +11,13 @@ module Nylas
11
11
  end
12
12
 
13
13
  def authenticate(name:, email_address:, provider:, settings:, reauth_account_id: nil,
14
- scopes: nil)
14
+ scopes: nil, return_full_response: false)
15
15
  scopes ||= %w[email calendar contacts]
16
16
  scopes = scopes.join(",") unless scopes.is_a?(String)
17
17
  code = retrieve_code(name: name, email_address: email_address, provider: provider,
18
18
  settings: settings, reauth_account_id: reauth_account_id, scopes: scopes)
19
19
 
20
- exchange_code_for_access_token(code)
20
+ exchange_code_for_access_token(code, return_full_response)
21
21
  end
22
22
 
23
23
  private
@@ -30,10 +30,10 @@ module Nylas
30
30
  response[:code]
31
31
  end
32
32
 
33
- def exchange_code_for_access_token(code)
33
+ def exchange_code_for_access_token(code, return_full_response)
34
34
  payload = { client_id: api.client.app_id, client_secret: api.client.app_secret, code: code }
35
35
  response = api.execute(method: :post, path: "/connect/token", payload: JSON.dump(payload))
36
- response[:access_token]
36
+ return_full_response ? response : response[:access_token]
37
37
  end
38
38
  end
39
39
  end
data/lib/nylas/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nylas
4
- VERSION = "5.15.0"
4
+ VERSION = "5.17.0"
5
5
  end
data/lib/nylas/webhook.rb CHANGED
@@ -19,7 +19,7 @@ module WebhookTrigger
19
19
  ACCOUNT_SYNC_ERROR = "account.sync_error"
20
20
  MESSAGE_CREATED = "message.created"
21
21
  MESSAGE_OPENED = "message.opened"
22
- MESSAGE_LINK_CLICKED = "message.link_created"
22
+ MESSAGE_LINK_CLICKED = "message.link_clicked"
23
23
  MESSAGE_UPDATED = "message.updated"
24
24
  MESSAGE_BOUNCED = "message.bounced"
25
25
  THREAD_REPLIED = "thread.replied"
@@ -34,12 +34,15 @@ module WebhookTrigger
34
34
  EVENT_DELETED = "event.deleted"
35
35
  JOB_SUCCESSFUL = "job.successful"
36
36
  JOB_FAILED = "job.failed"
37
+ JOB_DELAYED = "job.delayed"
38
+ JOB_CANCELLED = "job.cancelled"
37
39
  end
38
40
 
39
41
  module Nylas
40
42
  # Represents a webhook attached to your application.
41
43
  # @see https://docs.nylas.com/reference#webhooks
42
44
  class Webhook
45
+ require "openssl"
43
46
  include Model
44
47
  self.creatable = true
45
48
  self.listable = true
@@ -89,6 +92,16 @@ module Nylas
89
92
  "/a/#{api.app_id}/webhooks"
90
93
  end
91
94
 
95
+ # Verify incoming webhook signature came from Nylas
96
+ # @param nylas_signature [str] The signature to verify
97
+ # @param raw_body [str] The raw body from the payload
98
+ # @param client_secret [str] Client secret of the app receiving the webhook
99
+ # @return [Boolean] True if the webhook signature was verified from Nylas
100
+ def self.verify_webhook_signature(nylas_signature, raw_body, client_secret)
101
+ digest = OpenSSL::HMAC.hexdigest("SHA256", client_secret, raw_body)
102
+ digest == nylas_signature
103
+ end
104
+
92
105
  private
93
106
 
94
107
  def update_payload
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nylas
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.15.0
4
+ version: 5.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nylas, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-02 00:00:00.000000000 Z
11
+ date: 2023-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler