nylas 4.6.7 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nylas/api.rb +14 -1
- data/lib/nylas/collection.rb +11 -1
- data/lib/nylas/event.rb +3 -3
- data/lib/nylas/http_client.rb +2 -0
- data/lib/nylas/raw_message.rb +9 -2
- data/lib/nylas/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82a2a7e6af812dd58557c604deb553e18d586c373ee8c308b1eddc8492a44c28
|
4
|
+
data.tar.gz: 43b9a7943a854c10f2257d49220fc420ff4e3b022b76a527ba772041600d24dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c005ca3d6e0f61bc25ebdab118cc0dda5dd366c24b8ad1519b78a5bb32bd0de976b1070fb6dc35dfbd81ffd4540c636956c38f1248e412e80441cf12fb788d0
|
7
|
+
data.tar.gz: 05e47ffa2fb00e66adf7483b7eb7a0bd870c85dbff006dee3cfa7b968589173634d77d74519bc04e657d214efdfd17b1bc8ef492da0880edef5552fb012ac466
|
data/lib/nylas/api.rb
CHANGED
@@ -6,7 +6,7 @@ module Nylas
|
|
6
6
|
attr_accessor :client
|
7
7
|
|
8
8
|
extend Forwardable
|
9
|
-
def_delegators :client, :execute, :get, :post, :put, :delete, :app_id
|
9
|
+
def_delegators :client, :execute, :get, :post, :put, :delete, :app_id, :api_server
|
10
10
|
|
11
11
|
include Logging
|
12
12
|
|
@@ -37,6 +37,19 @@ module Nylas
|
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
40
|
+
def authentication_url(redirect_uri:, scopes:, response_type: "code", login_hint: nil, state: nil)
|
41
|
+
params = {
|
42
|
+
client_id: app_id,
|
43
|
+
redirect_uri: redirect_uri,
|
44
|
+
response_type: response_type,
|
45
|
+
login_hint: login_hint
|
46
|
+
}
|
47
|
+
params[:state] = state if state
|
48
|
+
params[:scopes] = scopes.join(",") if scopes
|
49
|
+
|
50
|
+
"#{api_server}/oauth/authorize?#{URI.encode_www_form(params)}"
|
51
|
+
end
|
52
|
+
|
40
53
|
def exchange_code_for_token(code)
|
41
54
|
data = {
|
42
55
|
"client_id" => app_id,
|
data/lib/nylas/collection.rb
CHANGED
@@ -130,7 +130,7 @@ module Nylas
|
|
130
130
|
response = api.execute(
|
131
131
|
**to_be_executed.merge(
|
132
132
|
path: "#{resources_path}/#{id}",
|
133
|
-
query:
|
133
|
+
query: view_query
|
134
134
|
)
|
135
135
|
)
|
136
136
|
model.from_hash(response, api: api)
|
@@ -147,5 +147,15 @@ module Nylas
|
|
147
147
|
def execute
|
148
148
|
api.execute(**to_be_executed)
|
149
149
|
end
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
def view_query
|
154
|
+
if constraints.view
|
155
|
+
{ view: constraints.view }
|
156
|
+
else
|
157
|
+
{}
|
158
|
+
end
|
159
|
+
end
|
150
160
|
end
|
151
161
|
end
|
data/lib/nylas/event.rb
CHANGED
@@ -9,9 +9,9 @@ module Nylas
|
|
9
9
|
allows_operations(creatable: true, listable: true, filterable: true, showable: true, updatable: true,
|
10
10
|
destroyable: true)
|
11
11
|
|
12
|
-
attribute :id, :string
|
13
|
-
attribute :object, :string
|
14
|
-
attribute :account_id, :string
|
12
|
+
attribute :id, :string, exclude_when: %i[saving]
|
13
|
+
attribute :object, :string, exclude_when: %i[saving]
|
14
|
+
attribute :account_id, :string, exclude_when: %i[saving]
|
15
15
|
attribute :calendar_id, :string
|
16
16
|
attribute :master_event_id, :string
|
17
17
|
attribute :message_id, :string
|
data/lib/nylas/http_client.rb
CHANGED
@@ -31,6 +31,7 @@ module Nylas
|
|
31
31
|
"/delta/longpoll" => 3650,
|
32
32
|
"/delta/streaming" => 3650
|
33
33
|
}.freeze
|
34
|
+
SUPPORTED_API_VERSION = "2.2"
|
34
35
|
|
35
36
|
include Logging
|
36
37
|
attr_accessor :api_server, :service_domain
|
@@ -137,6 +138,7 @@ module Nylas
|
|
137
138
|
@default_headers ||= {
|
138
139
|
"X-Nylas-API-Wrapper" => "ruby",
|
139
140
|
"X-Nylas-Client-Id" => @app_id,
|
141
|
+
"Nylas-API-Version" => SUPPORTED_API_VERSION,
|
140
142
|
"User-Agent" => "Nylas Ruby SDK #{Nylas::VERSION} - #{RUBY_VERSION}",
|
141
143
|
"Content-types" => "application/json"
|
142
144
|
}
|
data/lib/nylas/raw_message.rb
CHANGED
@@ -11,8 +11,15 @@ module Nylas
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def send!
|
14
|
-
Message.new(api.execute(
|
15
|
-
|
14
|
+
Message.new(**api.execute(
|
15
|
+
method: :post,
|
16
|
+
path: "/send",
|
17
|
+
payload: mime_compatible_string,
|
18
|
+
headers: HEADERS
|
19
|
+
).merge(api: api))
|
16
20
|
end
|
21
|
+
|
22
|
+
HEADERS = { "Content-type" => "message/rfc822" }.freeze
|
23
|
+
private_constant :HEADERS
|
17
24
|
end
|
18
25
|
end
|
data/lib/nylas/version.rb
CHANGED
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:
|
4
|
+
version: 5.0.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: 2021-
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|