nylas 6.2.1 → 6.2.2

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: d91ae3ccc20cfd009bfd1d7faf5e2d67488b1eee292823b0e0ec35cf56f56b58
4
- data.tar.gz: 22f379f3e2d40936efbab14391e21ec92a26551917286e6451ed99047e258bb7
3
+ metadata.gz: 51dfbc5793db11f12c6f01c13040346b5ec3cb272e30e3464363240e3e8ebf00
4
+ data.tar.gz: 3f76c739a761dfc92c8dfa12f71e0555e8d56399c61a297a7daeadfc861d019e
5
5
  SHA512:
6
- metadata.gz: aa88cd03b9163346a7b944203ab6882c337d74a7c034987f378eedd80d2b97d3b22c066d651ec6ffa220895d999df6b343c66e30a6914a10fe47ddd46d8584c0
7
- data.tar.gz: 6dc249dbc302dcbe07f93fa582c16fd93d4f3c0e33dc2bdf40dfcbcf5c29aca4b1e254f254b58658dd13cada5b5dcaf2ed5ced0a24b2a9b4e9983707da582463
6
+ metadata.gz: 77d860d38046bb599e43e7cc7b3460a20b512005d4fc4bb21704d7d1adbe5e5c81b5a01761f6050121b18bb68451d8e51f9f6e2b30c835ec6abc8d71f6cdb615
7
+ data.tar.gz: 58fb6f352d89b3b24328da83d07f6f823e4eb77e5b1bd078069294600ec5cea538e095aa437aa18ae69893045e6510ff66e2f3719e59adae70bacf6246a73e54
data/lib/nylas/errors.rb CHANGED
@@ -21,7 +21,7 @@ module Nylas
21
21
  # @param type [Hash] Error type.
22
22
  # @param message [String] Error message.
23
23
  # @param status_code [Integer] Error status code.
24
- # @param provider_error [String, nil] Provider error.
24
+ # @param provider_error [Hash, nil] The error from the provider.
25
25
  # @param request_id [Hash, nil] The ID of the request.
26
26
  def initialize(type, message, status_code, provider_error = nil, request_id = nil)
27
27
  super(message)
@@ -16,7 +16,7 @@ module Nylas
16
16
  # @param booking_id [String] The id of the booking to return.
17
17
  # @param query_params [Hash, nil] Query params to pass to the request.
18
18
  # @return [Array(Hash, String)] The booking and API request ID.
19
- def find(booking_id:, query_params:)
19
+ def find(booking_id:, query_params: nil)
20
20
  get(
21
21
  path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
22
22
  query_params: query_params
@@ -27,7 +27,7 @@ module Nylas
27
27
  # @param request_body [Hash] The values to create the booking with.
28
28
  # @param query_params [Hash, nil] Query params to pass to the request.
29
29
  # @return [Array(Hash, String)] The created booking and API Request ID.
30
- def create(request_body:, query_params:)
30
+ def create(request_body:, query_params: nil)
31
31
  post(
32
32
  path: "#{api_uri}/v3/scheduling/bookings",
33
33
  request_body: request_body,
@@ -40,7 +40,7 @@ module Nylas
40
40
  # @param booking_id [String] The id of the booking to update.
41
41
  # @param query_params [Hash, nil] Query params to pass to the request.
42
42
  # @return [Array(Hash, String)] The created booking and API Request ID.
43
- def update(request_body:, booking_id:, query_params:)
43
+ def update(request_body:, booking_id:, query_params: nil)
44
44
  patch(
45
45
  path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
46
46
  request_body: request_body,
@@ -53,7 +53,7 @@ module Nylas
53
53
  # @param request_body [Hash] The values to update the booking with
54
54
  # @param query_params [Hash, nil] Query params to pass to the request.
55
55
  # @return [Array(Hash, String)] The updated booking and API Request ID.
56
- def confirm_booking(booking_id:, request_body:, query_params:)
56
+ def confirm(booking_id:, request_body:, query_params: nil)
57
57
  put(
58
58
  path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
59
59
  request_body: request_body,
@@ -65,7 +65,7 @@ module Nylas
65
65
  # @param booking_id [String] The id of the booking to delete.
66
66
  # @param query_params [Hash, nil] Query params to pass to the request.
67
67
  # @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
68
- def destroy(booking_id:, query_params:)
68
+ def destroy(booking_id:, query_params: nil)
69
69
  _, request_id = delete(
70
70
  path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
71
71
  query_params: query_params
@@ -36,7 +36,16 @@ module Nylas
36
36
  file = File.open(attachment[:file_path], "rb")
37
37
  end
38
38
 
39
- form_data.merge!({ "file#{index}" => file })
39
+ # Setting original filename and content type if available. See rest-client#lib/restclient/payload.rb
40
+ filename = attachment[:filename] || attachment["filename"]
41
+ file.define_singleton_method(:original_filename) { filename } if filename
42
+
43
+ content_type = attachment[:content_type] || attachment["content_type"]
44
+ file.define_singleton_method(:content_type) { content_type } if content_type
45
+
46
+ content_id = attachment[:content_id] || attachment["content_id"] || "file#{index}"
47
+
48
+ form_data.merge!({ content_id => file })
40
49
  opened_files << file
41
50
  end
42
51
 
@@ -93,7 +102,7 @@ module Nylas
93
102
  # @param file_path [String] The path to the file to attach.
94
103
  # @param filename [String] The name of the attached file. Optional, derived from file_path by default.
95
104
  # @return [Hash] The request that will attach the file to the message/draft
96
- def self.attach_file_request_builder(file_path, filename = nil)
105
+ def self.attach_file_request_builder(file_path, filename = nil, content_id = nil)
97
106
  filename ||= File.basename(file_path)
98
107
  content_type = MIME::Types.type_for(file_path)
99
108
  content_type = if !content_type.nil? && !content_type.empty?
@@ -103,12 +112,12 @@ module Nylas
103
112
  end
104
113
  size = File.size(file_path)
105
114
  content = File.new(file_path, "rb")
106
-
107
115
  {
108
116
  filename: filename,
109
117
  content_type: content_type,
110
118
  size: size,
111
119
  content: content,
120
+ content_id: content_id,
112
121
  file_path: file_path
113
122
  }
114
123
  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 = "6.2.1"
4
+ VERSION = "6.2.2"
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: 6.2.1
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nylas, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-12 00:00:00.000000000 Z
11
+ date: 2024-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types