nylas 4.6.5 → 4.6.6

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: cc59654b2a73962455afa89f51aa5bd9b5dcfe7867c6a10add1da68725982db6
4
- data.tar.gz: 6df2f0c708e16d688666429edb793f736f9df1ae65fc310f3c1ffdf8fa197672
3
+ metadata.gz: baebc1d39fd0bc001c952f302dd417ac00399e139f90b6954080479c659d45ca
4
+ data.tar.gz: 554cf1807cb4432d1e7b75722c7da6846db751369085583adc08e09b0e1eaa9b
5
5
  SHA512:
6
- metadata.gz: c2bb1f816dbd759685097c76d7d03ee9a24870fd341a4cd2909cc33be5078f6a1bee9b72871d126a48f09e6e0edd047e2f1dd2b3b9b0205003f7cf8d2af6ac25
7
- data.tar.gz: dd34aa4b46d5de885dc3c0acca19fe4f0adfedec97b2790e2bff402c3240aa5c26c78f4b413c8cf817e5914eb8cd6788770a652ff21af4484c80b832ba44909f
6
+ metadata.gz: 7e388d554f86e260cba3950dcd2e4ec559009af1e285c0cbc90c9b8111bed522016292dbf6e907b2a0da89dfedf98bd99d7bc67bab552c3368681b4c0224dc76
7
+ data.tar.gz: 947425b241a41b35904eba088d71c2ad6bbb2e0221eb36ba01ff215274e42e852db66c587e047076ab3a81e06d86fac0a98e327b799881097ba7a502ea9b939c
data/lib/nylas/account.rb CHANGED
@@ -12,6 +12,7 @@ module Nylas
12
12
  attribute :account_id, :string
13
13
  attribute :billing_state, :string
14
14
  attribute :sync_state, :string
15
+ attribute :provider, :string
15
16
 
16
17
  attribute :email, :string
17
18
  attribute :trial, :boolean
data/lib/nylas/api.rb CHANGED
@@ -4,6 +4,7 @@ module Nylas
4
4
  # Methods to retrieve data from the Nylas API as Ruby objects
5
5
  class API
6
6
  attr_accessor :client
7
+
7
8
  extend Forwardable
8
9
  def_delegators :client, :execute, :get, :post, :put, :delete, :app_id
9
10
 
@@ -4,6 +4,7 @@ module Nylas
4
4
  # An enumerable for working with index and search endpoints
5
5
  class Collection
6
6
  attr_accessor :model, :api, :constraints
7
+
7
8
  extend Forwardable
8
9
  def_delegators :each, :map, :select, :reject, :to_a, :take
9
10
  def_delegators :to_a, :first, :last, :[]
@@ -4,6 +4,7 @@ module Nylas
4
4
  # The constraints a particular GET request will include in their query params
5
5
  class Constraints
6
6
  attr_accessor :where, :limit, :offset, :view, :per_page, :accept
7
+
7
8
  def initialize(where: {}, limit: nil, offset: 0, view: nil, per_page: 100, accept: "application/json")
8
9
  self.where = where
9
10
  self.limit = limit
@@ -4,6 +4,7 @@ module Nylas
4
4
  # Special collection for delta objects
5
5
  class DeltasCollection < Collection
6
6
  attr_accessor :deltas
7
+
7
8
  extend Forwardable
8
9
  def_delegators :execute, :cursor_start, :cursor_end,
9
10
  :count, :each, :to_h, :to_a, :empty?
data/lib/nylas/event.rb CHANGED
@@ -29,6 +29,8 @@ module Nylas
29
29
  attribute :when, :when
30
30
  attribute :original_start_time, :unix_timestamp
31
31
 
32
+ attr_accessor :notify_participants
33
+
32
34
  def busy?
33
35
  busy
34
36
  end
@@ -42,5 +44,17 @@ module Nylas
42
44
  event_id: id, account_id: account_id)
43
45
  rsvp.save
44
46
  end
47
+
48
+ private
49
+
50
+ def query_params
51
+ if notify_participants.nil?
52
+ {}
53
+ else
54
+ {
55
+ notify_participants: notify_participants
56
+ }
57
+ end
58
+ end
45
59
  end
46
60
  end
data/lib/nylas/file.rb CHANGED
@@ -21,6 +21,7 @@ module Nylas
21
21
  attribute :content_disposition, :string
22
22
 
23
23
  attr_accessor :file
24
+
24
25
  # Downloads and caches a local copy of the file.
25
26
  # @return [Tempfile] - Local copy of the file
26
27
  def download
data/lib/nylas/logging.rb CHANGED
@@ -1,12 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # We are explicitely choosing to allow clients to use or not use informed at their discretion
4
- # rubocop:disable Lint/HandleExceptions
5
3
  begin
6
4
  require "informed"
7
5
  rescue LoadError
8
6
  end
9
- # rubocop:enable Lint/HandleExceptions
10
7
 
11
8
  module Nylas
12
9
  # Exposes a shared logger for debugging purposes
data/lib/nylas/model.rb CHANGED
@@ -39,21 +39,31 @@ module Nylas
39
39
  !id.nil?
40
40
  end
41
41
 
42
- def execute(method:, payload: nil, path:)
43
- api.execute(method: method, payload: payload, path: path)
42
+ def execute(method:, payload: nil, path:, query: {})
43
+ api.execute(method: method, payload: payload, path: path, query: query)
44
44
  end
45
45
 
46
46
  def create
47
47
  raise ModelNotCreatableError, self unless creatable?
48
48
 
49
- execute(method: :post, payload: attributes.serialize, path: resources_path)
49
+ execute(
50
+ method: :post,
51
+ payload: attributes.serialize,
52
+ path: resources_path,
53
+ query: query_params
54
+ )
50
55
  end
51
56
 
52
57
  def update(**data)
53
58
  raise ModelNotUpdatableError, model_class unless updatable?
54
59
 
55
60
  attributes.merge(**data)
56
- execute(method: :put, payload: attributes.serialize(keys: data.keys), path: resource_path)
61
+ execute(
62
+ method: :put,
63
+ payload: attributes.serialize(keys: data.keys),
64
+ path: resource_path,
65
+ query: query_params
66
+ )
57
67
  true
58
68
  rescue Registry::MissingKeyError => e
59
69
  raise ModelMissingFieldError.new(e.key, self)
@@ -75,7 +85,7 @@ module Nylas
75
85
  def destroy
76
86
  raise ModelNotDestroyableError, self unless destroyable?
77
87
 
78
- execute(method: :delete, path: resource_path)
88
+ execute(method: :delete, path: resource_path, query: query_params)
79
89
  end
80
90
 
81
91
  # @return [String] JSON String of the model.
@@ -99,6 +109,10 @@ module Nylas
99
109
  )
100
110
  end
101
111
 
112
+ def query_params
113
+ {}
114
+ end
115
+
102
116
  # Allows you to narrow in exactly what kind of model you're working with
103
117
  module ClassMethods
104
118
  attr_accessor :raw_mime_type, :creatable, :showable, :filterable, :searchable, :listable, :updatable,
@@ -7,6 +7,7 @@ module Nylas
7
7
  extend Forwardable
8
8
  def_delegators :type, :cast, :serialize
9
9
  attr_accessor :type_name, :exclude_when, :default
10
+
10
11
  def initialize(type_name:, exclude_when:, default:)
11
12
  self.type_name = type_name
12
13
  self.exclude_when = exclude_when
@@ -39,6 +39,7 @@ module Nylas
39
39
  # Methods to call when tweaking Transferable classes
40
40
  module ClassMethods
41
41
  attr_accessor :attribute_recipients
42
+
42
43
  def init_attribute_recipients
43
44
  self.attribute_recipients ||= {}
44
45
  end
@@ -5,6 +5,7 @@ module Nylas
5
5
  # @see https://docs.nylas.com/reference#native-authentication-1
6
6
  class NativeAuthentication
7
7
  attr_accessor :api
8
+
8
9
  def initialize(api:)
9
10
  self.api = api
10
11
  end
@@ -4,6 +4,7 @@ module Nylas
4
4
  # Allows sending of email with nylas from an rfc822 compatible string
5
5
  class RawMessage
6
6
  attr_accessor :api, :mime_compatible_string
7
+
7
8
  def initialize(mime_compatible_string, api:)
8
9
  self.api = api
9
10
  self.mime_compatible_string = mime_compatible_string
@@ -8,6 +8,7 @@ module Nylas
8
8
  # Includes the list of keys in the registry for debug purposes.
9
9
  class MissingKeyError < Error
10
10
  attr_accessor :key
11
+
11
12
  def initialize(key, keys)
12
13
  super("key #{key} not in #{keys}")
13
14
  self.key = key
data/lib/nylas/types.rb CHANGED
@@ -24,6 +24,7 @@ module Nylas
24
24
  # {Model} or Model-like thing.
25
25
  class ModelType
26
26
  attr_accessor :model
27
+
27
28
  def initialize(model:)
28
29
  self.model = model
29
30
  end
@@ -87,6 +88,7 @@ module Nylas
87
88
 
88
89
  def serialize(object)
89
90
  return nil if object.nil?
91
+
90
92
  object.to_i
91
93
  end
92
94
  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 = "4.6.5"
4
+ VERSION = "4.6.6"
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.5
4
+ version: 4.6.6
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-02-22 00:00:00.000000000 Z
11
+ date: 2021-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler