nylas 5.17.0 → 6.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nylas/client.rb +121 -0
  3. data/lib/nylas/config.rb +19 -0
  4. data/lib/nylas/errors.rb +63 -89
  5. data/lib/nylas/handler/api_operations.rb +162 -0
  6. data/lib/nylas/handler/http_client.rb +252 -0
  7. data/lib/nylas/resources/applications.rb +27 -0
  8. data/lib/nylas/resources/attachments.rb +65 -0
  9. data/lib/nylas/resources/auth.rb +209 -0
  10. data/lib/nylas/resources/calendars.rb +101 -0
  11. data/lib/nylas/resources/connectors.rb +80 -0
  12. data/lib/nylas/resources/contacts.rb +89 -0
  13. data/lib/nylas/resources/credentials.rb +75 -0
  14. data/lib/nylas/resources/drafts.rb +121 -0
  15. data/lib/nylas/resources/events.rb +98 -0
  16. data/lib/nylas/resources/folders.rb +73 -0
  17. data/lib/nylas/resources/grants.rb +59 -0
  18. data/lib/nylas/resources/messages.rb +135 -0
  19. data/lib/nylas/resources/redirect_uris.rb +68 -0
  20. data/lib/nylas/resources/resource.rb +18 -0
  21. data/lib/nylas/resources/smart_compose.rb +36 -0
  22. data/lib/nylas/resources/threads.rb +62 -0
  23. data/lib/nylas/resources/webhooks.rb +121 -0
  24. data/lib/nylas/utils/file_utils.rb +61 -0
  25. data/lib/nylas/version.rb +1 -1
  26. data/lib/nylas.rb +31 -148
  27. metadata +88 -247
  28. data/lib/nylas/account.rb +0 -56
  29. data/lib/nylas/api.rb +0 -246
  30. data/lib/nylas/application_details.rb +0 -13
  31. data/lib/nylas/calendar.rb +0 -46
  32. data/lib/nylas/calendar_collection.rb +0 -144
  33. data/lib/nylas/categorize.rb +0 -14
  34. data/lib/nylas/collection.rb +0 -175
  35. data/lib/nylas/component.rb +0 -35
  36. data/lib/nylas/component_collection.rb +0 -10
  37. data/lib/nylas/constraints.rb +0 -56
  38. data/lib/nylas/contact.rb +0 -53
  39. data/lib/nylas/contact_group.rb +0 -23
  40. data/lib/nylas/current_account.rb +0 -23
  41. data/lib/nylas/delta.rb +0 -56
  42. data/lib/nylas/deltas.rb +0 -19
  43. data/lib/nylas/deltas_collection.rb +0 -40
  44. data/lib/nylas/draft.rb +0 -100
  45. data/lib/nylas/email_address.rb +0 -12
  46. data/lib/nylas/event.rb +0 -144
  47. data/lib/nylas/event_collection.rb +0 -15
  48. data/lib/nylas/event_conferencing.rb +0 -12
  49. data/lib/nylas/event_conferencing_autocreate.rb +0 -10
  50. data/lib/nylas/event_conferencing_details.rb +0 -14
  51. data/lib/nylas/event_notification.rb +0 -17
  52. data/lib/nylas/file.rb +0 -75
  53. data/lib/nylas/filter_attributes.rb +0 -25
  54. data/lib/nylas/folder.rb +0 -26
  55. data/lib/nylas/free_busy.rb +0 -13
  56. data/lib/nylas/free_busy_collection.rb +0 -48
  57. data/lib/nylas/http_client.rb +0 -279
  58. data/lib/nylas/im_address.rb +0 -11
  59. data/lib/nylas/job_status.rb +0 -27
  60. data/lib/nylas/job_status_collection.rb +0 -21
  61. data/lib/nylas/label.rb +0 -27
  62. data/lib/nylas/logging.rb +0 -41
  63. data/lib/nylas/message.rb +0 -98
  64. data/lib/nylas/message_headers.rb +0 -27
  65. data/lib/nylas/message_tracking.rb +0 -13
  66. data/lib/nylas/model/attributable.rb +0 -89
  67. data/lib/nylas/model/attribute_definition.rb +0 -24
  68. data/lib/nylas/model/attributes.rb +0 -97
  69. data/lib/nylas/model/list_attribute_definition.rb +0 -39
  70. data/lib/nylas/model/transferable.rb +0 -53
  71. data/lib/nylas/model.rb +0 -217
  72. data/lib/nylas/native_authentication.rb +0 -39
  73. data/lib/nylas/neural.rb +0 -87
  74. data/lib/nylas/neural_categorizer.rb +0 -29
  75. data/lib/nylas/neural_clean_conversation.rb +0 -33
  76. data/lib/nylas/neural_contact_link.rb +0 -11
  77. data/lib/nylas/neural_contact_name.rb +0 -11
  78. data/lib/nylas/neural_message_options.rb +0 -35
  79. data/lib/nylas/neural_ocr.rb +0 -16
  80. data/lib/nylas/neural_sentiment_analysis.rb +0 -17
  81. data/lib/nylas/neural_signature_contact.rb +0 -81
  82. data/lib/nylas/neural_signature_extraction.rb +0 -18
  83. data/lib/nylas/new_message.rb +0 -39
  84. data/lib/nylas/nylas_date.rb +0 -25
  85. data/lib/nylas/open_hours.rb +0 -15
  86. data/lib/nylas/outbox.rb +0 -116
  87. data/lib/nylas/outbox_job_status.rb +0 -19
  88. data/lib/nylas/outbox_message.rb +0 -17
  89. data/lib/nylas/participant.rb +0 -13
  90. data/lib/nylas/phone_number.rb +0 -11
  91. data/lib/nylas/physical_address.rb +0 -17
  92. data/lib/nylas/raw_message.rb +0 -25
  93. data/lib/nylas/recurrence.rb +0 -11
  94. data/lib/nylas/registry.rb +0 -42
  95. data/lib/nylas/room_resource.rb +0 -19
  96. data/lib/nylas/rsvp.rb +0 -24
  97. data/lib/nylas/scheduler.rb +0 -51
  98. data/lib/nylas/scheduler_booking_confirmation.rb +0 -24
  99. data/lib/nylas/scheduler_booking_request.rb +0 -17
  100. data/lib/nylas/scheduler_collection.rb +0 -104
  101. data/lib/nylas/scheduler_config.rb +0 -20
  102. data/lib/nylas/scheduler_time_slot.rb +0 -14
  103. data/lib/nylas/search_collection.rb +0 -10
  104. data/lib/nylas/send_grid_verified_status.rb +0 -12
  105. data/lib/nylas/services/tunnel.rb +0 -128
  106. data/lib/nylas/thread.rb +0 -66
  107. data/lib/nylas/time_slot.rb +0 -16
  108. data/lib/nylas/time_slot_capacity.rb +0 -13
  109. data/lib/nylas/timespan.rb +0 -20
  110. data/lib/nylas/token_info.rb +0 -20
  111. data/lib/nylas/types.rb +0 -168
  112. data/lib/nylas/web_page.rb +0 -11
  113. data/lib/nylas/webhook.rb +0 -111
  114. data/lib/nylas/when.rb +0 -75
data/lib/nylas.rb CHANGED
@@ -7,15 +7,14 @@ require "rest-client"
7
7
  # See https://github.com/sparklemotion/http-cookie/issues/27
8
8
  # and https://github.com/sparklemotion/http-cookie/issues/6
9
9
  #
10
- # CookieJar uses unsafe class caching for dynamically loading cookie jars
11
- # If 2 rest-client instances are instantiated at the same time, (in threads)
12
- # non-deterministic behaviour can occur whereby the Hash cookie jar isn't
13
- # properly loaded and cached.
14
- # Forcing an instantiation of the jar onload will force the CookieJar to load
15
- # before the system has a chance to spawn any threads.
16
- # Note this should technically be fixed in rest-client itself however that
17
- # library appears to be stagnant so we're forced to fix it here
18
- # This object should get GC'd as it's not referenced by anything
10
+ # CookieJar uses unsafe class caching for dynamically loading cookie jars.
11
+ # If two rest-client instances are instantiated at the same time (in threads), non-deterministic
12
+ # behaviour can occur whereby the Hash cookie jar isn't properly loaded and cached.
13
+ # Forcing an instantiation of the jar onload will force the CookieJar to load before the system has
14
+ # a chance to spawn any threads.
15
+ # Note that this should technically be fixed in rest-client itself, however that library appears to
16
+ # be stagnant so we're forced to fix it here.
17
+ # This object should get GC'd as it's not referenced by anything.
19
18
  HTTP::CookieJar.new
20
19
 
21
20
  require "ostruct"
@@ -23,142 +22,26 @@ require "forwardable"
23
22
 
24
23
  require_relative "nylas/version"
25
24
  require_relative "nylas/errors"
26
-
27
- require_relative "nylas/logging"
28
- require_relative "nylas/registry"
29
- require_relative "nylas/types"
30
- require_relative "nylas/constraints"
31
-
32
- require_relative "nylas/http_client"
33
- require_relative "nylas/api"
34
- require_relative "nylas/collection"
35
- require_relative "nylas/model"
36
-
37
- # Attribute types supported by the API
38
- require_relative "nylas/email_address"
39
- require_relative "nylas/event"
40
- require_relative "nylas/file"
41
- require_relative "nylas/folder"
42
- require_relative "nylas/im_address"
43
- require_relative "nylas/label"
44
- require_relative "nylas/message_headers"
45
- require_relative "nylas/message_tracking"
46
- require_relative "nylas/participant"
47
- require_relative "nylas/physical_address"
48
- require_relative "nylas/phone_number"
49
- require_relative "nylas/recurrence"
50
- require_relative "nylas/rsvp"
51
- require_relative "nylas/timespan"
52
- require_relative "nylas/web_page"
53
- require_relative "nylas/nylas_date"
54
- require_relative "nylas/when"
55
- require_relative "nylas/free_busy"
56
- require_relative "nylas/time_slot"
57
- require_relative "nylas/time_slot_capacity"
58
- require_relative "nylas/open_hours"
59
- require_relative "nylas/event_conferencing"
60
- require_relative "nylas/event_conferencing_details"
61
- require_relative "nylas/event_conferencing_autocreate"
62
- require_relative "nylas/event_notification"
63
- require_relative "nylas/component"
64
-
65
- # Custom collection types
66
- require_relative "nylas/event_collection"
67
- require_relative "nylas/search_collection"
68
- require_relative "nylas/deltas_collection"
69
- require_relative "nylas/free_busy_collection"
70
- require_relative "nylas/calendar_collection"
71
- require_relative "nylas/component_collection"
72
- require_relative "nylas/scheduler_collection"
73
- require_relative "nylas/job_status_collection"
74
- require_relative "nylas/outbox"
75
-
76
- # Models supported by the API
77
- require_relative "nylas/account"
78
- require_relative "nylas/calendar"
79
- require_relative "nylas/contact"
80
- require_relative "nylas/contact_group"
81
- require_relative "nylas/current_account"
82
- require_relative "nylas/deltas"
83
- require_relative "nylas/delta"
84
- require_relative "nylas/draft"
85
- require_relative "nylas/message"
86
- require_relative "nylas/room_resource"
87
- require_relative "nylas/new_message"
88
- require_relative "nylas/raw_message"
89
- require_relative "nylas/thread"
90
- require_relative "nylas/webhook"
91
- require_relative "nylas/scheduler"
92
- require_relative "nylas/job_status"
93
- require_relative "nylas/token_info"
94
- require_relative "nylas/application_details"
95
- require_relative "nylas/outbox_message"
96
- require_relative "nylas/outbox_job_status"
97
- require_relative "nylas/send_grid_verified_status"
98
-
99
- # Neural specific types
100
- require_relative "nylas/neural"
101
- require_relative "nylas/neural_sentiment_analysis"
102
- require_relative "nylas/neural_ocr"
103
- require_relative "nylas/neural_categorizer"
104
- require_relative "nylas/neural_clean_conversation"
105
- require_relative "nylas/neural_contact_link"
106
- require_relative "nylas/neural_contact_name"
107
- require_relative "nylas/neural_signature_contact"
108
- require_relative "nylas/neural_signature_extraction"
109
- require_relative "nylas/neural_message_options"
110
- require_relative "nylas/categorize"
111
- require_relative "nylas/scheduler_config"
112
- require_relative "nylas/scheduler_time_slot"
113
- require_relative "nylas/scheduler_booking_request"
114
- require_relative "nylas/scheduler_booking_confirmation"
115
-
116
- require_relative "nylas/native_authentication"
117
-
118
- require_relative "nylas/filter_attributes"
119
-
120
- require_relative "nylas/services/tunnel"
121
- # an SDK for interacting with the Nylas API
122
- # @see https://docs.nylas.com/reference
123
- module Nylas
124
- Types.registry[:account] = Types::ModelType.new(model: Account)
125
- Types.registry[:calendar] = Types::ModelType.new(model: Calendar)
126
- Types.registry[:contact] = Types::ModelType.new(model: Contact)
127
- Types.registry[:delta] = DeltaType.new
128
- Types.registry[:draft] = Types::ModelType.new(model: Draft)
129
- Types.registry[:email_address] = Types::ModelType.new(model: EmailAddress)
130
- Types.registry[:event] = Types::ModelType.new(model: Event)
131
- Types.registry[:file] = Types::ModelType.new(model: File)
132
- Types.registry[:folder] = Types::ModelType.new(model: Folder)
133
- Types.registry[:im_address] = Types::ModelType.new(model: IMAddress)
134
- Types.registry[:label] = Types::ModelType.new(model: Label)
135
- Types.registry[:room_resource] = Types::ModelType.new(model: RoomResource)
136
- Types.registry[:message] = Types::ModelType.new(model: Message)
137
- Types.registry[:message_headers] = MessageHeadersType.new
138
- Types.registry[:message_tracking] = Types::ModelType.new(model: MessageTracking)
139
- Types.registry[:participant] = Types::ModelType.new(model: Participant)
140
- Types.registry[:physical_address] = Types::ModelType.new(model: PhysicalAddress)
141
- Types.registry[:phone_number] = Types::ModelType.new(model: PhoneNumber)
142
- Types.registry[:recurrence] = Types::ModelType.new(model: Recurrence)
143
- Types.registry[:thread] = Types::ModelType.new(model: Thread)
144
- Types.registry[:timespan] = Types::ModelType.new(model: Timespan)
145
- Types.registry[:web_page] = Types::ModelType.new(model: WebPage)
146
- Types.registry[:nylas_date] = NylasDateType.new
147
- Types.registry[:contact_group] = Types::ModelType.new(model: ContactGroup)
148
- Types.registry[:when] = Types::ModelType.new(model: When)
149
- Types.registry[:time_slot] = Types::ModelType.new(model: TimeSlot)
150
- Types.registry[:time_slot_capacity] = Types::ModelType.new(model: TimeSlotCapacity)
151
- Types.registry[:event_conferencing] = Types::ModelType.new(model: EventConferencing)
152
- Types.registry[:event_conferencing_details] = Types::ModelType.new(model: EventConferencingDetails)
153
- Types.registry[:event_conferencing_autocreate] = Types::ModelType.new(model: EventConferencingAutocreate)
154
- Types.registry[:event_notification] = Types::ModelType.new(model: EventNotification)
155
- Types.registry[:neural] = Types::ModelType.new(model: Neural)
156
- Types.registry[:categorize] = Types::ModelType.new(model: Categorize)
157
- Types.registry[:neural_signature_contact] = Types::ModelType.new(model: NeuralSignatureContact)
158
- Types.registry[:neural_contact_link] = Types::ModelType.new(model: NeuralContactLink)
159
- Types.registry[:neural_contact_name] = Types::ModelType.new(model: NeuralContactName)
160
- Types.registry[:scheduler_config] = Types::ModelType.new(model: SchedulerConfig)
161
- Types.registry[:scheduler_time_slot] = Types::ModelType.new(model: SchedulerTimeSlot)
162
- Types.registry[:job_status] = Types::ModelType.new(model: JobStatus)
163
- Types.registry[:outbox_message] = Types::ModelType.new(model: OutboxMessage)
164
- end
25
+ require_relative "nylas/client"
26
+ require_relative "nylas/config"
27
+
28
+ require_relative "nylas/handler/http_client"
29
+
30
+ require_relative "nylas/resources/applications"
31
+ require_relative "nylas/resources/attachments"
32
+ require_relative "nylas/resources/auth"
33
+ require_relative "nylas/resources/calendars"
34
+ require_relative "nylas/resources/connectors"
35
+ require_relative "nylas/resources/contacts"
36
+ require_relative "nylas/resources/credentials"
37
+ require_relative "nylas/resources/drafts"
38
+ require_relative "nylas/resources/events"
39
+ require_relative "nylas/resources/folders"
40
+ require_relative "nylas/resources/grants"
41
+ require_relative "nylas/resources/messages"
42
+ require_relative "nylas/resources/smart_compose"
43
+ require_relative "nylas/resources/threads"
44
+ require_relative "nylas/resources/redirect_uris"
45
+ require_relative "nylas/resources/webhooks"
46
+
47
+ require_relative "nylas/utils/file_utils"