nylas 5.17.0 → 6.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nylas/client.rb +62 -0
  3. data/lib/nylas/config.rb +19 -0
  4. data/lib/nylas/errors.rb +41 -89
  5. data/lib/nylas/handler/admin_api_operations.rb +95 -0
  6. data/lib/nylas/handler/api_operations.rb +138 -0
  7. data/lib/nylas/handler/grants_api_operations.rb +99 -0
  8. data/lib/nylas/handler/http_client.rb +179 -0
  9. data/lib/nylas/resources/applications.rb +27 -0
  10. data/lib/nylas/resources/auth.rb +197 -0
  11. data/lib/nylas/resources/calendars.rb +31 -0
  12. data/lib/nylas/resources/events.rb +20 -0
  13. data/lib/nylas/resources/grants.rb +20 -0
  14. data/lib/nylas/resources/redirect_uris.rb +20 -0
  15. data/lib/nylas/resources/resource.rb +18 -0
  16. data/lib/nylas/resources/webhooks.rb +37 -0
  17. data/lib/nylas/version.rb +1 -1
  18. data/lib/nylas.rb +20 -148
  19. metadata +70 -257
  20. data/lib/nylas/account.rb +0 -56
  21. data/lib/nylas/api.rb +0 -246
  22. data/lib/nylas/application_details.rb +0 -13
  23. data/lib/nylas/calendar.rb +0 -46
  24. data/lib/nylas/calendar_collection.rb +0 -144
  25. data/lib/nylas/categorize.rb +0 -14
  26. data/lib/nylas/collection.rb +0 -175
  27. data/lib/nylas/component.rb +0 -35
  28. data/lib/nylas/component_collection.rb +0 -10
  29. data/lib/nylas/constraints.rb +0 -56
  30. data/lib/nylas/contact.rb +0 -53
  31. data/lib/nylas/contact_group.rb +0 -23
  32. data/lib/nylas/current_account.rb +0 -23
  33. data/lib/nylas/delta.rb +0 -56
  34. data/lib/nylas/deltas.rb +0 -19
  35. data/lib/nylas/deltas_collection.rb +0 -40
  36. data/lib/nylas/draft.rb +0 -100
  37. data/lib/nylas/email_address.rb +0 -12
  38. data/lib/nylas/event.rb +0 -144
  39. data/lib/nylas/event_collection.rb +0 -15
  40. data/lib/nylas/event_conferencing.rb +0 -12
  41. data/lib/nylas/event_conferencing_autocreate.rb +0 -10
  42. data/lib/nylas/event_conferencing_details.rb +0 -14
  43. data/lib/nylas/event_notification.rb +0 -17
  44. data/lib/nylas/file.rb +0 -75
  45. data/lib/nylas/filter_attributes.rb +0 -25
  46. data/lib/nylas/folder.rb +0 -26
  47. data/lib/nylas/free_busy.rb +0 -13
  48. data/lib/nylas/free_busy_collection.rb +0 -48
  49. data/lib/nylas/http_client.rb +0 -279
  50. data/lib/nylas/im_address.rb +0 -11
  51. data/lib/nylas/job_status.rb +0 -27
  52. data/lib/nylas/job_status_collection.rb +0 -21
  53. data/lib/nylas/label.rb +0 -27
  54. data/lib/nylas/logging.rb +0 -41
  55. data/lib/nylas/message.rb +0 -98
  56. data/lib/nylas/message_headers.rb +0 -27
  57. data/lib/nylas/message_tracking.rb +0 -13
  58. data/lib/nylas/model/attributable.rb +0 -89
  59. data/lib/nylas/model/attribute_definition.rb +0 -24
  60. data/lib/nylas/model/attributes.rb +0 -97
  61. data/lib/nylas/model/list_attribute_definition.rb +0 -39
  62. data/lib/nylas/model/transferable.rb +0 -53
  63. data/lib/nylas/model.rb +0 -217
  64. data/lib/nylas/native_authentication.rb +0 -39
  65. data/lib/nylas/neural.rb +0 -87
  66. data/lib/nylas/neural_categorizer.rb +0 -29
  67. data/lib/nylas/neural_clean_conversation.rb +0 -33
  68. data/lib/nylas/neural_contact_link.rb +0 -11
  69. data/lib/nylas/neural_contact_name.rb +0 -11
  70. data/lib/nylas/neural_message_options.rb +0 -35
  71. data/lib/nylas/neural_ocr.rb +0 -16
  72. data/lib/nylas/neural_sentiment_analysis.rb +0 -17
  73. data/lib/nylas/neural_signature_contact.rb +0 -81
  74. data/lib/nylas/neural_signature_extraction.rb +0 -18
  75. data/lib/nylas/new_message.rb +0 -39
  76. data/lib/nylas/nylas_date.rb +0 -25
  77. data/lib/nylas/open_hours.rb +0 -15
  78. data/lib/nylas/outbox.rb +0 -116
  79. data/lib/nylas/outbox_job_status.rb +0 -19
  80. data/lib/nylas/outbox_message.rb +0 -17
  81. data/lib/nylas/participant.rb +0 -13
  82. data/lib/nylas/phone_number.rb +0 -11
  83. data/lib/nylas/physical_address.rb +0 -17
  84. data/lib/nylas/raw_message.rb +0 -25
  85. data/lib/nylas/recurrence.rb +0 -11
  86. data/lib/nylas/registry.rb +0 -42
  87. data/lib/nylas/room_resource.rb +0 -19
  88. data/lib/nylas/rsvp.rb +0 -24
  89. data/lib/nylas/scheduler.rb +0 -51
  90. data/lib/nylas/scheduler_booking_confirmation.rb +0 -24
  91. data/lib/nylas/scheduler_booking_request.rb +0 -17
  92. data/lib/nylas/scheduler_collection.rb +0 -104
  93. data/lib/nylas/scheduler_config.rb +0 -20
  94. data/lib/nylas/scheduler_time_slot.rb +0 -14
  95. data/lib/nylas/search_collection.rb +0 -10
  96. data/lib/nylas/send_grid_verified_status.rb +0 -12
  97. data/lib/nylas/services/tunnel.rb +0 -128
  98. data/lib/nylas/thread.rb +0 -66
  99. data/lib/nylas/time_slot.rb +0 -16
  100. data/lib/nylas/time_slot_capacity.rb +0 -13
  101. data/lib/nylas/timespan.rb +0 -20
  102. data/lib/nylas/token_info.rb +0 -20
  103. data/lib/nylas/types.rb +0 -168
  104. data/lib/nylas/web_page.rb +0 -11
  105. data/lib/nylas/webhook.rb +0 -111
  106. data/lib/nylas/when.rb +0 -75
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent a the Neural Categorizer object.
5
- # @see https://developer.nylas.com/docs/intelligence/categorizer/#categorize-message-response
6
- class NeuralCategorizer < Message
7
- include Model
8
- self.resources_path = "/neural/categorize"
9
- self.listable = true
10
-
11
- attribute :categorizer, :categorize
12
- # Overrides Message's label attribute as currently categorize returns
13
- # list of strings for labels instead of label object types
14
- has_n_of_attribute :labels, :string
15
-
16
- inherit_attributes
17
-
18
- def recategorize(category)
19
- body = { message_id: id, category: category }
20
- api.execute(
21
- method: :post,
22
- path: "#{resources_path}/feedback",
23
- payload: JSON.dump(body)
24
- )
25
- list = api.neural.categorize([id])
26
- list[0]
27
- end
28
- end
29
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent a the Neural Clean Conversations object.
5
- # @see https://developer.nylas.com/docs/intelligence/clean-conversations/#clean-conversation-response
6
- class NeuralCleanConversation < Message
7
- include Model
8
- self.resources_path = "/neural/conversation"
9
- self.listable = true
10
- IMAGE_REGEX = /[(']cid:(.*?)[)']/.freeze
11
-
12
- attribute :conversation, :string
13
- attribute :model_version, :string
14
-
15
- inherit_attributes
16
-
17
- # Parses image file IDs found in the clean conversation object and returns
18
- # an array of File objects returned from the File API
19
- def extract_images
20
- return if conversation.nil?
21
-
22
- files = []
23
- matches = conversation.scan(IMAGE_REGEX)
24
- matches.each do |match|
25
- # After applying the regex, if there are IDs found they would be
26
- # in the form of => 'cid:xxxx' (including apostrophes), so we discard
27
- # everything before and after the file ID (denoted as xxxx above)
28
- files.push(api.files.find(match))
29
- end
30
- files
31
- end
32
- end
33
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent the "Link" object in the Neural API's Signature Extraction Contact object
5
- # @see https://developer.nylas.com/docs/intelligence/signature-extraction/#parse-signature-response
6
- class NeuralContactLink
7
- include Model::Attributable
8
- attribute :description, :string
9
- attribute :url, :string
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent the "Name" object in the Neural API's Signature Extraction Contact object
5
- # @see https://developer.nylas.com/docs/intelligence/signature-extraction/#parse-signature-response
6
- class NeuralContactName
7
- include Model::Attributable
8
- attribute :first_name, :string
9
- attribute :last_name, :string
10
- end
11
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent a the Neural Optical Character Recognition object.
5
- # @see https://developer.nylas.com/docs/intelligence/optical-charecter-recognition/#ocr-response
6
- class NeuralMessageOptions
7
- attr_accessor :ignore_links, :ignore_images, :ignore_tables, :remove_conclusion_phrases,
8
- :images_as_markdown, :parse_contact
9
-
10
- def initialize(ignore_links: nil,
11
- ignore_images: nil,
12
- ignore_tables: nil,
13
- remove_conclusion_phrases: nil,
14
- images_as_markdown: nil,
15
- parse_contact: nil)
16
- @ignore_links = ignore_links
17
- @ignore_images = ignore_images
18
- @ignore_tables = ignore_tables
19
- @remove_conclusion_phrases = remove_conclusion_phrases
20
- @images_as_markdown = images_as_markdown
21
- @parse_contact = parse_contact
22
- end
23
-
24
- def to_hash
25
- hash = {}
26
- hash[:ignore_links] = @ignore_links unless @ignore_links.nil?
27
- hash[:ignore_images] = @ignore_images unless @ignore_images.nil?
28
- hash[:ignore_tables] = @ignore_tables unless @ignore_tables.nil?
29
- hash[:remove_conclusion_phrases] = @remove_conclusion_phrases unless @remove_conclusion_phrases.nil?
30
- hash[:images_as_markdown] = @images_as_markdown unless @images_as_markdown.nil?
31
- hash[:parse_contact] = @parse_contact unless @parse_contact.nil?
32
- hash
33
- end
34
- end
35
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent a the Neural Optical Character Recognition object.
5
- # @see https://developer.nylas.com/docs/intelligence/optical-charecter-recognition/#ocr-response
6
- class NeuralOcr < File
7
- include Model
8
- self.resources_path = "/neural/ocr"
9
- self.listable = true
10
-
11
- has_n_of_attribute :ocr, :string
12
- attribute :processed_pages, :integer
13
-
14
- inherit_attributes
15
- end
16
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent a the Neural Sentiment Analysis object.
5
- # @see https://developer.nylas.com/docs/intelligence/sentiment-analysis/#sentiment-analysis-response-message
6
- class NeuralSentimentAnalysis
7
- include Model
8
- self.resources_path = "/neural/sentiment"
9
- self.listable = true
10
-
11
- attribute :account_id, :string
12
- attribute :sentiment, :string
13
- attribute :sentiment_score, :float
14
- attribute :processed_length, :integer
15
- attribute :text, :string
16
- end
17
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent the Neural API's Signature Extraction Contact object
5
- # @see https://developer.nylas.com/docs/intelligence/signature-extraction/#parse-signature-response
6
- class NeuralSignatureContact
7
- include Model::Attributable
8
- has_n_of_attribute :job_titles, :string
9
- has_n_of_attribute :links, :neural_contact_link
10
- has_n_of_attribute :phone_numbers, :string
11
- has_n_of_attribute :emails, :string
12
- has_n_of_attribute :names, :neural_contact_name
13
-
14
- attr_accessor :api
15
-
16
- # Creates a Nylas contact object compatible with the contact endpoints.
17
- # Please note if multiple names or multiple job titles were parsed only
18
- # the first set are used.
19
- def to_contact_object
20
- contact = merge_multiple_hashes([convert_names, convert_emails, convert_phone_numbers, convert_links])
21
- contact[:job_title] = job_titles[0] unless job_titles.nil?
22
- Contact.new(**contact.merge(api: api))
23
- end
24
-
25
- private
26
-
27
- def convert_names
28
- return {} if names.empty?
29
-
30
- contact = {}
31
- contact[:given_name] = names[0].first_name if names[0].first_name
32
- contact[:surname] = names[0].last_name if names[0].last_name
33
- contact
34
- end
35
-
36
- def convert_emails
37
- return {} if emails.empty?
38
-
39
- contact = {}
40
- contact[:emails] = []
41
- emails.each do |e|
42
- contact[:emails].push(type: "personal", email: e)
43
- end
44
- contact
45
- end
46
-
47
- def convert_phone_numbers
48
- return {} if phone_numbers.empty?
49
-
50
- contact = {}
51
- contact[:phone_numbers] = []
52
- phone_numbers.each do |number|
53
- contact[:phone_numbers].push(type: "mobile", number: number)
54
- end
55
- contact
56
- end
57
-
58
- def convert_links
59
- return {} if links.empty?
60
-
61
- contact = {}
62
- contact[:web_pages] = []
63
- links.each do |link|
64
- type = "homepage"
65
- type = link.description unless link.description.empty?
66
- contact[:web_pages].push(type: type, url: link.url)
67
- end
68
- contact
69
- end
70
-
71
- # For Ruby 2.5 support as it doesn't support multiple hashes to merge at once
72
- def merge_multiple_hashes(hashes_to_merge)
73
- hash = {}
74
- hashes_to_merge.each do |new_hash|
75
- hash = hash.merge(new_hash)
76
- end
77
-
78
- hash
79
- end
80
- end
81
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent a the Signature Extraction Schema.
5
- # @see https://developer.nylas.com/docs/intelligence/signature-extraction/#signature-feedback-response
6
- class NeuralSignatureExtraction < Message
7
- include Model
8
- self.resources_path = "/neural/signature"
9
-
10
- attribute :signature, :string
11
- attribute :model_version, :string
12
- attribute :contacts, :neural_signature_contact
13
-
14
- inherit_attributes
15
-
16
- transfer :api, to: %i[contacts]
17
- end
18
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Data structure for sending a message via the Nylas API
5
- class NewMessage
6
- include Model
7
- self.creatable = false
8
- self.showable = false
9
- self.listable = false
10
- self.filterable = false
11
- self.updatable = false
12
- self.destroyable = false
13
-
14
- has_n_of_attribute :to, :email_address
15
- has_n_of_attribute :from, :email_address
16
- has_n_of_attribute :cc, :email_address
17
- has_n_of_attribute :bcc, :email_address
18
- has_n_of_attribute :reply_to, :email_address
19
-
20
- attribute :subject, :string
21
- attribute :body, :string
22
- attribute :reply_to_message_id, :string
23
- attribute :metadata, :hash
24
-
25
- has_n_of_attribute :file_ids, :string
26
-
27
- attribute :tracking, :message_tracking
28
-
29
- # Sends the new message
30
- # @return [Message] The sent message
31
- # @raise [RuntimeError] if the API response data was not a hash
32
- def send!
33
- message_data = api.execute(method: :post, path: "/send", payload: to_json)
34
- raise "Unexpected response from the server, data received not a Message" unless message_data.is_a?(Hash)
35
-
36
- Message.from_hash(message_data, api: api)
37
- end
38
- end
39
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent Nylas's more complex Date Schema
5
- # @see https://docs.nylas.com/reference#contactsid
6
- class NylasDate
7
- extend Forwardable
8
- def_delegators :date, :===, :==, :<=>, :eql?, :equal?
9
-
10
- include Model::Attributable
11
- attribute :object, :string
12
- attribute :date, :date
13
- end
14
-
15
- # Serializes, Deserializes between {NylasDate} objects and a {Hash}
16
- class NylasDateType < Types::ModelType
17
- def initialize
18
- super(model: NylasDate)
19
- end
20
-
21
- def cast(value)
22
- value.is_a?(String) ? super({ object: "date", date: value }) : super
23
- end
24
- end
25
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Additional times email accounts are available
5
- # @see https://developer.nylas.com/docs/api/#post/calendars/availability
6
- class OpenHours
7
- include Model::Attributable
8
-
9
- attribute :timezone, :string
10
- attribute :start, :string
11
- attribute :end, :string
12
- has_n_of_attribute :emails, :string
13
- has_n_of_attribute :days, :integer
14
- end
15
- end
data/lib/nylas/outbox.rb DELETED
@@ -1,116 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Methods for Outbox functionality
5
- # @see https://developer.nylas.com/docs/api/#tag--Outbox
6
- class Outbox
7
- attr_accessor :api
8
-
9
- def initialize(api:)
10
- self.api = api
11
- end
12
-
13
- def outbox_path
14
- @outbox_path ||= "/v2/outbox"
15
- end
16
-
17
- # rubocop:disable Layout/LineLength
18
- # Send a message via Outbox
19
- # @param draft [Draft, OutboxMessage] The message to send
20
- # @param send_at [Numeric] The date and time to send the message. If not set, Outbox will send this message immediately.
21
- # @param retry_limit_datetime [Numeric] The date and time to stop retry attempts for a message. If not set, it defaults to 24 hours after send_at.
22
- # @return [OutboxJobStatus] The outbox job status status and message data
23
- # rubocop:enable Layout/LineLength
24
- def send(draft, send_at: nil, retry_limit_datetime: nil)
25
- message = draft.to_h(enforce_read_only: true)
26
- message.merge!(validate_set_date_time(send_at, retry_limit_datetime))
27
- outbox_response = api.execute(
28
- method: :post,
29
- path: outbox_path,
30
- payload: JSON.dump(message)
31
- )
32
-
33
- OutboxJobStatus.new(**outbox_response)
34
- end
35
-
36
- # rubocop:disable Layout/LineLength
37
- # Update a scheduled Outbox message
38
- # @param job_status_id [String] The ID of the outbox job status
39
- # @param message [Draft, OutboxMessage] The message object with updated values
40
- # @param send_at [Numeric] The date and time to send the message. If not set, Outbox will send this message immediately.
41
- # @param retry_limit_datetime [Numeric] The date and time to stop retry attempts for a message. If not set, it defaults to 24 hours after send_at.
42
- # @return [OutboxJobStatus] The updated outbox job status status and message data
43
- # rubocop:enable Layout/LineLength
44
- def update(job_status_id, message: nil, send_at: nil, retry_limit_datetime: nil)
45
- payload = {}
46
- payload.merge!(message.to_h(enforce_read_only: true)) if message
47
- payload.merge!(validate_set_date_time(send_at, retry_limit_datetime))
48
- outbox_response = api.execute(
49
- method: :patch,
50
- path: "#{outbox_path}/#{job_status_id}",
51
- payload: JSON.dump(payload)
52
- )
53
-
54
- OutboxJobStatus.new(**outbox_response)
55
- end
56
-
57
- # Delete a scheduled Outbox message
58
- # @param job_status_id [String] The ID of the outbox job status to delete
59
- # @return [void]
60
- def delete(job_status_id)
61
- api.execute(
62
- method: :delete,
63
- path: "#{outbox_path}/#{job_status_id}"
64
- )
65
- end
66
-
67
- # SendGrid - Check Authentication and Verification Status
68
- # @return [SendGridVerifiedStatus] The SendGrid Authentication and Verification Status
69
- def send_grid_verification_status
70
- response = api.execute(
71
- method: :get,
72
- path: "#{outbox_path}/onboard/verified_status"
73
- )
74
-
75
- raise "Verification status not present in response" if response.key?("results")
76
-
77
- SendGridVerifiedStatus.new(**response[:results])
78
- end
79
-
80
- # SendGrid - Delete SendGrid Subuser and UAS Grant
81
- # @param email [String] Email address for SendGrid subuser to delete
82
- # @return [void]
83
- def delete_send_grid_sub_user(email)
84
- api.execute(
85
- method: :delete,
86
- path: "#{outbox_path}/onboard/subuser",
87
- payload: JSON.dump({ email: email })
88
- )
89
- end
90
-
91
- private
92
-
93
- def validate_set_date_time(send_at, retry_limit_datetime)
94
- hash = {}
95
- hash[:send_at] = validate_send_at(send_at) if send_at
96
- if retry_limit_datetime
97
- hash[:retry_limit_datetime] = validate_retry_limit_datetime(send_at, retry_limit_datetime)
98
- end
99
-
100
- hash
101
- end
102
-
103
- def validate_send_at(send_at)
104
- return send_at unless send_at != 0 && (send_at < Time.now.to_i)
105
-
106
- raise ArgumentError, "Cannot set message to be sent at a time before the current time."
107
- end
108
-
109
- def validate_retry_limit_datetime(send_at, retry_limit_datetime)
110
- valid_send_at = send_at && send_at != 0 ? send_at : Time.now.to_i
111
- return retry_limit_datetime unless retry_limit_datetime != 0 && (retry_limit_datetime < valid_send_at)
112
-
113
- raise ArgumentError, "Cannot set message to stop retrying before time to send at."
114
- end
115
- end
116
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Ruby representation of a Nylas Outbox Job Status object
5
- # @see https://developer.nylas.com/docs/api/#post/v2/outbox
6
- class OutboxJobStatus < JobStatus
7
- include Model
8
-
9
- attribute :send_at, :unix_timestamp
10
- attribute :original_send_at, :unix_timestamp
11
- attribute :message_id, :string
12
- attribute :thread_id, :string
13
- attribute :original_data, :outbox_message
14
-
15
- transfer :api, to: %i[original_data]
16
-
17
- inherit_attributes
18
- end
19
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Ruby representation of a Nylas Outbox Message object
5
- # @see https://developer.nylas.com/docs/api/#post/v2/outbox
6
- class OutboxMessage < Draft
7
- include Model
8
-
9
- attribute :send_at, :unix_timestamp
10
- attribute :retry_limit_datetime, :unix_timestamp
11
- attribute :original_send_at, :unix_timestamp, read_only: true
12
-
13
- transfer :api, to: %i[events files folder labels]
14
-
15
- inherit_attributes
16
- end
17
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent the Participant
5
- class Participant
6
- include Model::Attributable
7
- attribute :name, :string
8
- attribute :email, :string
9
- attribute :phone_number, :string
10
- attribute :comment, :string
11
- attribute :status, :string, read_only: true
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent the Phone Number Schema
5
- # @see https://docs.nylas.com/reference#contactsid
6
- class PhoneNumber
7
- include Model::Attributable
8
- attribute :type, :string
9
- attribute :number, :string
10
- end
11
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Structure to represent the Physical Address schema
5
- # @see https://docs.nylas.com/reference#contactsid
6
- class PhysicalAddress
7
- include Model::Attributable
8
- attribute :format, :string
9
- attribute :type, :string
10
- attribute :street_address, :string
11
- attribute :postal_code, :string
12
- attribute :state, :string
13
- attribute :city, :string
14
- attribute :country, :string
15
- attribute :secondary_address, :string
16
- end
17
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Allows sending of email with nylas from an rfc822 compatible string
5
- class RawMessage
6
- attr_accessor :api, :mime_compatible_string
7
-
8
- def initialize(mime_compatible_string, api:)
9
- self.api = api
10
- self.mime_compatible_string = mime_compatible_string
11
- end
12
-
13
- def send!
14
- Message.new(**api.execute(
15
- method: :post,
16
- path: "/send",
17
- payload: mime_compatible_string,
18
- headers: HEADERS
19
- ).merge(api: api))
20
- end
21
-
22
- HEADERS = { "Content-type" => "message/rfc822" }.freeze
23
- private_constant :HEADERS
24
- end
25
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Representation of a Recurrence object
5
- # @see https://docs.nylas.com/reference#section-recurrence
6
- class Recurrence
7
- include Model::Attributable
8
- has_n_of_attribute :rrule, :string
9
- attribute :timezone, :string
10
- end
11
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Used to create a hash-like structure which defaults to raising an exception in the event the key to
5
- # retrieve does not exist.
6
- class Registry
7
- # Used to indicate an attempt to retrieve something not yet registered in a registry
8
- # Includes the list of keys in the registry for debug purposes.
9
- class MissingKeyError < Error
10
- attr_accessor :key
11
-
12
- def initialize(key, keys)
13
- super("key #{key} not in #{keys}")
14
- self.key = key
15
- end
16
- end
17
- attr_accessor :registry_data
18
-
19
- extend Forwardable
20
- def_delegators :registry_data, :keys, :each, :reduce, :key?
21
-
22
- def initialize(initial_data = {})
23
- self.registry_data = initial_data.each.each_with_object({}) do |(key, value), registry|
24
- registry[key] = value
25
- end
26
- end
27
-
28
- def [](key)
29
- registry_data.fetch(key)
30
- rescue KeyError
31
- raise MissingKeyError.new(key, keys)
32
- end
33
-
34
- def []=(key, value)
35
- registry_data[key] = value
36
- end
37
-
38
- def to_h
39
- registry_data
40
- end
41
- end
42
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Ruby representation of a Nylas Room Resource object
5
- # @see https://developer.nylas.com/docs/api/#tag--Room-Resources
6
- class RoomResource
7
- include Model
8
- self.resources_path = "/resources"
9
- self.listable = true
10
-
11
- attribute :object, :string, read_only: true
12
- attribute :email, :string, read_only: true
13
- attribute :name, :string, read_only: true
14
- attribute :capacity, :string, read_only: true
15
- attribute :building, :string, read_only: true
16
- attribute :floor_name, :string, read_only: true
17
- attribute :floor_number, :string, read_only: true
18
- end
19
- end
data/lib/nylas/rsvp.rb DELETED
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nylas
4
- # Allows RSVPing to a particular event
5
- # @see https://docs.nylas.com/reference#rsvping-to-invitations
6
- class Rsvp
7
- include Model
8
- self.creatable = true
9
-
10
- attribute :account_id, :string
11
- attribute :event_id, :string
12
- attribute :status, :string
13
- attr_accessor :notify_participants
14
-
15
- def save
16
- api.execute(
17
- method: :post,
18
- path: "/send-rsvp",
19
- payload: attributes.serialize_for_api,
20
- query: { notify_participants: notify_participants }
21
- )
22
- end
23
- end
24
- end