nylas 4.6.2 → 4.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25e0ba2a96bed5ddf666a1dfd4ca590039b555d4e3917ec2c9a5b24bb2b97c1a
4
- data.tar.gz: e8f459d8ce121e5fbf26ecfac41836f173cb55eed5423f883bb3ce3f5092ae1f
3
+ metadata.gz: 34f645631bf41230a0c8709c0212c5b83fb24fa44bdf3b7b62429ec72ce92b41
4
+ data.tar.gz: 2d043ada950f30d03b65f45cb1e0635868cd7c092d919f992b1d9359519c995b
5
5
  SHA512:
6
- metadata.gz: 3c4df432759f47064f5e1601cfc70a36d6bf80551df7a067d74766be2fba1a048a6af5d222f2b1a25b356f579d110e036d1155d2351fc8fa7cf7e6bdaa19fa56
7
- data.tar.gz: 66f9f88677d6d3893fa4dc35742e8d05457bcd69a2d6b94b9afe8bff8cf40c4eb80d30edd4813d8d82431fdc00dced2223f24a73513178617704ddc081e33f0d
6
+ metadata.gz: 3af07161869273f8fa33a38c97c286ec4c62aebb37b303e2fee348773c7d1c33ddb7c45531a95d792af21c90eca9055e1181b3fca2f5a412fd1809037ec5c70b
7
+ data.tar.gz: ea27a61dee30fc747b42fd2713e4755ca7f50243bbcf47d2bb8582aec96f1613ae3795206c62a5905ee4fbdc353c69f1c3f191e40f5b5b319728ccdd4cb80085
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nylas
4
+ require "yajl"
5
+
4
6
  # Plain HTTP client that can be used to interact with the Nylas API sans any type casting.
5
7
  class HttpClient # rubocop:disable Metrics/ClassLength
6
8
  HTTP_CODE_TO_EXCEPTIONS = {
@@ -130,9 +132,10 @@ module Nylas
130
132
  end
131
133
 
132
134
  def parse_response(response)
133
- response.is_a?(Enumerable) ? response : JSON.parse(response, symbolize_names: true)
134
- rescue JSON::ParserError
135
- response
135
+ return response if response.is_a?(Enumerable)
136
+
137
+ json = StringIO.new(response)
138
+ Yajl::Parser.new(symbolize_names: true).parse(json)
136
139
  end
137
140
  inform_on :parse_response, level: :debug, also_log: { result: true }
138
141
 
@@ -69,5 +69,23 @@ module Nylas
69
69
  assign(api.execute(method: :get, path: resource_path, query: { view: "expanded" }))
70
70
  self
71
71
  end
72
+
73
+ def save_call
74
+ handle_folder
75
+
76
+ execute(
77
+ method: :put,
78
+ payload: attributes.serialize(keys: allowed_keys_for_save),
79
+ path: resource_path
80
+ )
81
+ end
82
+
83
+ def handle_folder
84
+ return if folder.nil?
85
+
86
+ self.folder_id = folder.id if folder_id.nil? && !self.to_h.dig(:folder, :id).nil?
87
+
88
+ self.folder = nil
89
+ end
72
90
  end
73
91
  end
@@ -12,5 +12,6 @@ module Nylas
12
12
  attribute :state, :string
13
13
  attribute :city, :string
14
14
  attribute :country, :string
15
+ attribute :secondary_address, :string
15
16
  end
16
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nylas
4
- VERSION = "4.6.2"
4
+ VERSION = "4.6.3"
5
5
  end
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.6.2
4
+ version: 4.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nylas, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-09 00:00:00.000000000 Z
11
+ date: 2020-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -254,6 +254,26 @@ dependencies:
254
254
  - - "<"
255
255
  - !ruby/object:Gem::Version
256
256
  version: '3.0'
257
+ - !ruby/object:Gem::Dependency
258
+ name: yajl-ruby
259
+ requirement: !ruby/object:Gem::Requirement
260
+ requirements:
261
+ - - "~>"
262
+ - !ruby/object:Gem::Version
263
+ version: '1.2'
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ version: 1.2.1
267
+ type: :runtime
268
+ prerelease: false
269
+ version_requirements: !ruby/object:Gem::Requirement
270
+ requirements:
271
+ - - "~>"
272
+ - !ruby/object:Gem::Version
273
+ version: '1.2'
274
+ - - ">="
275
+ - !ruby/object:Gem::Version
276
+ version: 1.2.1
257
277
  description: Gem for interacting with the Nylas API.
258
278
  email: support@nylas.com
259
279
  executables: []