surge_api 0.2.0 → 0.3.0

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/README.md +12 -63
  4. data/lib/surge_api/internal/transport/base_client.rb +7 -1
  5. data/lib/surge_api/internal/transport/pooled_net_requester.rb +38 -26
  6. data/lib/surge_api/internal/type/union.rb +12 -0
  7. data/lib/surge_api/internal/util.rb +5 -5
  8. data/lib/surge_api/models/account_create_params.rb +13 -6
  9. data/lib/surge_api/models/account_update_params.rb +13 -6
  10. data/lib/surge_api/models/campaign_create_params.rb +7 -183
  11. data/lib/surge_api/models/campaign_params.rb +228 -0
  12. data/lib/surge_api/models/message_create_params.rb +8 -134
  13. data/lib/surge_api/models/message_params.rb +216 -0
  14. data/lib/surge_api/models/message_retrieve_params.rb +14 -0
  15. data/lib/surge_api/models/unwrap_webhook_event.rb +11 -9
  16. data/lib/surge_api/models.rb +6 -0
  17. data/lib/surge_api/resources/campaigns.rb +7 -18
  18. data/lib/surge_api/resources/messages.rb +27 -12
  19. data/lib/surge_api/version.rb +1 -1
  20. data/lib/surge_api.rb +5 -0
  21. data/manifest.yaml +2 -0
  22. data/rbi/surge_api/internal/transport/base_client.rbi +5 -0
  23. data/rbi/surge_api/internal/transport/pooled_net_requester.rbi +6 -2
  24. data/rbi/surge_api/internal/type/base_model.rbi +8 -4
  25. data/rbi/surge_api/models/account_create_params.rbi +19 -8
  26. data/rbi/surge_api/models/account_update_params.rbi +19 -8
  27. data/rbi/surge_api/models/campaign_create_params.rbi +20 -346
  28. data/rbi/surge_api/models/campaign_params.rbi +481 -0
  29. data/rbi/surge_api/models/message_create_params.rbi +24 -243
  30. data/rbi/surge_api/models/message_params.rbi +430 -0
  31. data/rbi/surge_api/models/message_retrieve_params.rbi +27 -0
  32. data/rbi/surge_api/models.rbi +6 -0
  33. data/rbi/surge_api/resources/campaigns.rbi +4 -89
  34. data/rbi/surge_api/resources/messages.rbi +19 -22
  35. data/sig/surge_api/internal/transport/base_client.rbs +2 -0
  36. data/sig/surge_api/internal/transport/pooled_net_requester.rbs +4 -1
  37. data/sig/surge_api/models/campaign_create_params.rbs +7 -106
  38. data/sig/surge_api/models/campaign_params.rbs +141 -0
  39. data/sig/surge_api/models/message_create_params.rbs +7 -119
  40. data/sig/surge_api/models/message_params.rbs +189 -0
  41. data/sig/surge_api/models/message_retrieve_params.rbs +15 -0
  42. data/sig/surge_api/models.rbs +6 -0
  43. data/sig/surge_api/resources/campaigns.rbs +1 -9
  44. data/sig/surge_api/resources/messages.rbs +6 -6
  45. metadata +11 -2
@@ -0,0 +1,216 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # Payload for creating a message. Either an attachment or the body must be given.
6
+ # You can specify the recipient either using the 'conversation' parameter or the
7
+ # 'to'/'from' parameters, but not both.
8
+ module MessageParams
9
+ extend SurgeAPI::Internal::Type::Union
10
+
11
+ # Create a message while including parameters for the conversation in which the message should be sent.
12
+ variant -> { SurgeAPI::MessageParams::MessageParamsWithConversation }
13
+
14
+ # Create a basic message by specifying just the to/from phone numbers.
15
+ variant -> { SurgeAPI::MessageParams::SimpleMessageParams }
16
+
17
+ class MessageParamsWithConversation < SurgeAPI::Internal::Type::BaseModel
18
+ # @!attribute conversation
19
+ # Params for selecting or creating a new conversation. Either the id or the
20
+ # Contact must be given.
21
+ #
22
+ # @return [SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Conversation]
23
+ required :conversation, -> { SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation }
24
+
25
+ # @!attribute attachments
26
+ #
27
+ # @return [Array<SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Attachment>, nil]
28
+ optional :attachments,
29
+ -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageParams::MessageParamsWithConversation::Attachment] }
30
+
31
+ # @!attribute body
32
+ # The message body.
33
+ #
34
+ # @return [String, nil]
35
+ optional :body, String
36
+
37
+ # @!attribute send_at
38
+ # An optional datetime for scheduling message up to a couple of months in the
39
+ # future.
40
+ #
41
+ # @return [Time, nil]
42
+ optional :send_at, Time
43
+
44
+ # @!method initialize(conversation:, attachments: nil, body: nil, send_at: nil)
45
+ # Some parameter documentations has been truncated, see
46
+ # {SurgeAPI::Models::MessageParams::MessageParamsWithConversation} for more
47
+ # details.
48
+ #
49
+ # Create a message while including parameters for the conversation in which the
50
+ # message should be sent.
51
+ #
52
+ # @param conversation [SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Conversation] Params for selecting or creating a new conversation. Either the id or the Contac
53
+ #
54
+ # @param attachments [Array<SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Attachment>]
55
+ #
56
+ # @param body [String] The message body.
57
+ #
58
+ # @param send_at [Time] An optional datetime for scheduling message up to a couple of months in the futu
59
+
60
+ # @see SurgeAPI::Models::MessageParams::MessageParamsWithConversation#conversation
61
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
62
+ # @!attribute contact
63
+ # Parameters for creating a contact
64
+ #
65
+ # @return [SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Conversation::Contact]
66
+ required :contact, -> { SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::Contact }
67
+
68
+ # @!attribute phone_number
69
+ # The phone number from which to send the message. This can be either the phone
70
+ # number in E.164 format or a Surge phone number id.
71
+ #
72
+ # @return [String, nil]
73
+ optional :phone_number, String
74
+
75
+ # @!method initialize(contact:, phone_number: nil)
76
+ # Some parameter documentations has been truncated, see
77
+ # {SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Conversation}
78
+ # for more details.
79
+ #
80
+ # Params for selecting or creating a new conversation. Either the id or the
81
+ # Contact must be given.
82
+ #
83
+ # @param contact [SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Conversation::Contact] Parameters for creating a contact
84
+ #
85
+ # @param phone_number [String] The phone number from which to send the message. This can be either the phone nu
86
+
87
+ # @see SurgeAPI::Models::MessageParams::MessageParamsWithConversation::Conversation#contact
88
+ class Contact < SurgeAPI::Internal::Type::BaseModel
89
+ # @!attribute phone_number
90
+ # The contact's phone number in E.164 format.
91
+ #
92
+ # @return [String]
93
+ required :phone_number, String
94
+
95
+ # @!attribute email
96
+ # The contact's email address.
97
+ #
98
+ # @return [String, nil]
99
+ optional :email, String
100
+
101
+ # @!attribute first_name
102
+ # The contact's first name.
103
+ #
104
+ # @return [String, nil]
105
+ optional :first_name, String
106
+
107
+ # @!attribute last_name
108
+ # The contact's last name.
109
+ #
110
+ # @return [String, nil]
111
+ optional :last_name, String
112
+
113
+ # @!attribute metadata
114
+ # Set of key-value pairs that will be stored with the object.
115
+ #
116
+ # @return [Hash{Symbol=>String}, nil]
117
+ optional :metadata, SurgeAPI::Internal::Type::HashOf[String]
118
+
119
+ # @!method initialize(phone_number:, email: nil, first_name: nil, last_name: nil, metadata: nil)
120
+ # Parameters for creating a contact
121
+ #
122
+ # @param phone_number [String] The contact's phone number in E.164 format.
123
+ #
124
+ # @param email [String] The contact's email address.
125
+ #
126
+ # @param first_name [String] The contact's first name.
127
+ #
128
+ # @param last_name [String] The contact's last name.
129
+ #
130
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
131
+ end
132
+ end
133
+
134
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
135
+ # @!attribute url
136
+ # The URL of the attachment.
137
+ #
138
+ # @return [String]
139
+ required :url, String
140
+
141
+ # @!method initialize(url:)
142
+ # Params for creating an attachment
143
+ #
144
+ # @param url [String] The URL of the attachment.
145
+ end
146
+ end
147
+
148
+ class SimpleMessageParams < SurgeAPI::Internal::Type::BaseModel
149
+ # @!attribute to
150
+ # The recipient's phone number in E.164 format. Cannot be used together with
151
+ # 'conversation'.
152
+ #
153
+ # @return [String]
154
+ required :to, String
155
+
156
+ # @!attribute attachments
157
+ #
158
+ # @return [Array<SurgeAPI::Models::MessageParams::SimpleMessageParams::Attachment>, nil]
159
+ optional :attachments,
160
+ -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageParams::SimpleMessageParams::Attachment] }
161
+
162
+ # @!attribute body
163
+ # The message body.
164
+ #
165
+ # @return [String, nil]
166
+ optional :body, String
167
+
168
+ # @!attribute from
169
+ # The sender's phone number in E.164 format or phone number ID. If omitted, uses
170
+ # the account's default phone number. Cannot be used together with 'conversation'.
171
+ #
172
+ # @return [String, nil]
173
+ optional :from, String
174
+
175
+ # @!attribute send_at
176
+ # An optional datetime for scheduling message up to a couple of months in the
177
+ # future.
178
+ #
179
+ # @return [Time, nil]
180
+ optional :send_at, Time
181
+
182
+ # @!method initialize(to:, attachments: nil, body: nil, from: nil, send_at: nil)
183
+ # Some parameter documentations has been truncated, see
184
+ # {SurgeAPI::Models::MessageParams::SimpleMessageParams} for more details.
185
+ #
186
+ # Create a basic message by specifying just the to/from phone numbers.
187
+ #
188
+ # @param to [String] The recipient's phone number in E.164 format. Cannot be used together with 'conv
189
+ #
190
+ # @param attachments [Array<SurgeAPI::Models::MessageParams::SimpleMessageParams::Attachment>]
191
+ #
192
+ # @param body [String] The message body.
193
+ #
194
+ # @param from [String] The sender's phone number in E.164 format or phone number ID. If omitted, uses t
195
+ #
196
+ # @param send_at [Time] An optional datetime for scheduling message up to a couple of months in the futu
197
+
198
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
199
+ # @!attribute url
200
+ # The URL of the attachment.
201
+ #
202
+ # @return [String]
203
+ required :url, String
204
+
205
+ # @!method initialize(url:)
206
+ # Params for creating an attachment
207
+ #
208
+ # @param url [String] The URL of the attachment.
209
+ end
210
+ end
211
+
212
+ # @!method self.variants
213
+ # @return [Array(SurgeAPI::Models::MessageParams::MessageParamsWithConversation, SurgeAPI::Models::MessageParams::SimpleMessageParams)]
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Messages#retrieve
6
+ class MessageRetrieveParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -5,23 +5,25 @@ module SurgeAPI
5
5
  module UnwrapWebhookEvent
6
6
  extend SurgeAPI::Internal::Type::Union
7
7
 
8
- variant -> { SurgeAPI::CallEndedWebhookEvent }
8
+ discriminator :type
9
9
 
10
- variant -> { SurgeAPI::CampaignApprovedWebhookEvent }
10
+ variant :"call.ended", -> { SurgeAPI::CallEndedWebhookEvent }
11
11
 
12
- variant -> { SurgeAPI::ContactOptedInWebhookEvent }
12
+ variant :"campaign.approved", -> { SurgeAPI::CampaignApprovedWebhookEvent }
13
13
 
14
- variant -> { SurgeAPI::ContactOptedOutWebhookEvent }
14
+ variant :"contact.opted_in", -> { SurgeAPI::ContactOptedInWebhookEvent }
15
15
 
16
- variant -> { SurgeAPI::ConversationCreatedWebhookEvent }
16
+ variant :"contact.opted_out", -> { SurgeAPI::ContactOptedOutWebhookEvent }
17
17
 
18
- variant -> { SurgeAPI::MessageDeliveredWebhookEvent }
18
+ variant :"conversation.created", -> { SurgeAPI::ConversationCreatedWebhookEvent }
19
19
 
20
- variant -> { SurgeAPI::MessageFailedWebhookEvent }
20
+ variant :"message.delivered", -> { SurgeAPI::MessageDeliveredWebhookEvent }
21
21
 
22
- variant -> { SurgeAPI::MessageReceivedWebhookEvent }
22
+ variant :"message.failed", -> { SurgeAPI::MessageFailedWebhookEvent }
23
23
 
24
- variant -> { SurgeAPI::MessageSentWebhookEvent }
24
+ variant :"message.received", -> { SurgeAPI::MessageReceivedWebhookEvent }
25
+
26
+ variant :"message.sent", -> { SurgeAPI::MessageSentWebhookEvent }
25
27
 
26
28
  # @!method self.variants
27
29
  # @return [Array(SurgeAPI::Models::CallEndedWebhookEvent, SurgeAPI::Models::CampaignApprovedWebhookEvent, SurgeAPI::Models::ContactOptedInWebhookEvent, SurgeAPI::Models::ContactOptedOutWebhookEvent, SurgeAPI::Models::ConversationCreatedWebhookEvent, SurgeAPI::Models::MessageDeliveredWebhookEvent, SurgeAPI::Models::MessageFailedWebhookEvent, SurgeAPI::Models::MessageReceivedWebhookEvent, SurgeAPI::Models::MessageSentWebhookEvent)]
@@ -61,6 +61,8 @@ module SurgeAPI
61
61
 
62
62
  CampaignCreateParams = SurgeAPI::Models::CampaignCreateParams
63
63
 
64
+ CampaignParams = SurgeAPI::Models::CampaignParams
65
+
64
66
  Contact = SurgeAPI::Models::Contact
65
67
 
66
68
  ContactCreateParams = SurgeAPI::Models::ContactCreateParams
@@ -85,8 +87,12 @@ module SurgeAPI
85
87
 
86
88
  MessageFailedWebhookEvent = SurgeAPI::Models::MessageFailedWebhookEvent
87
89
 
90
+ MessageParams = SurgeAPI::Models::MessageParams
91
+
88
92
  MessageReceivedWebhookEvent = SurgeAPI::Models::MessageReceivedWebhookEvent
89
93
 
94
+ MessageRetrieveParams = SurgeAPI::Models::MessageRetrieveParams
95
+
90
96
  MessageSentWebhookEvent = SurgeAPI::Models::MessageSentWebhookEvent
91
97
 
92
98
  Organization = SurgeAPI::Models::Organization
@@ -8,27 +8,11 @@ module SurgeAPI
8
8
  #
9
9
  # Creates a campaign to register account to send text messages.
10
10
  #
11
- # @overload create(account_id, consent_flow:, description:, message_samples:, privacy_policy_url:, use_cases:, volume:, includes: nil, link_sample: nil, terms_and_conditions_url: nil, request_options: {})
11
+ # @overload create(account_id, campaign_params:, request_options: {})
12
12
  #
13
13
  # @param account_id [String] The account for which the campaign should be created.
14
14
  #
15
- # @param consent_flow [String] A string explaining the method through which end users will opt in to receive me
16
- #
17
- # @param description [String] An explanation of the organization's purpose and how it will be using text messa
18
- #
19
- # @param message_samples [Array<String>] An array of 2-5 strings with examples of the messages that will be sent from thi
20
- #
21
- # @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
22
- #
23
- # @param use_cases [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
24
- #
25
- # @param volume [Symbol, SurgeAPI::Models::CampaignCreateParams::Volume] This will be one of the following:
26
- #
27
- # @param includes [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::Include>] A list of properties that this campaign should include. These properties can be
28
- #
29
- # @param link_sample [String] A sample link that might be sent by this campaign. If links from other domains a
30
- #
31
- # @param terms_and_conditions_url [String] The URL of the terms and conditions presented to end users when they opt in to m
15
+ # @param campaign_params [SurgeAPI::CampaignParams] Parameters for creating a new campaign. Either provide full campaign details or
32
16
  #
33
17
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
34
18
  #
@@ -37,6 +21,11 @@ module SurgeAPI
37
21
  # @see SurgeAPI::Models::CampaignCreateParams
38
22
  def create(account_id, params)
39
23
  parsed, options = SurgeAPI::CampaignCreateParams.dump_request(params)
24
+ case parsed
25
+ in {campaign_params: Hash => union, **rest}
26
+ parsed = {**rest, **union}
27
+ else
28
+ end
40
29
  @client.request(
41
30
  method: :post,
42
31
  path: ["accounts/%1$s/campaigns", account_id],
@@ -32,21 +32,11 @@ module SurgeAPI
32
32
  # `conversation` field, and `conversation.phone_number` should be specified
33
33
  # instead.
34
34
  #
35
- # @overload create(account_id, conversation:, to:, attachments: nil, body: nil, send_at: nil, from: nil, request_options: {})
35
+ # @overload create(account_id, message_params:, request_options: {})
36
36
  #
37
37
  # @param account_id [String] The account from which the message should be sent.
38
38
  #
39
- # @param conversation [SurgeAPI::Models::MessageCreateParams::Conversation] Params for selecting or creating a new conversation. Either the id or the Contac
40
- #
41
- # @param to [String] The recipient's phone number in E.164 format. Cannot be used together with 'conv
42
- #
43
- # @param attachments [Array<SurgeAPI::Models::MessageCreateParams::Attachment>]
44
- #
45
- # @param body [String] The message body.
46
- #
47
- # @param send_at [Time] An optional datetime for scheduling message up to a couple of months in the futu
48
- #
49
- # @param from [String] The sender's phone number in E.164 format or phone number ID. If omitted, uses t
39
+ # @param message_params [SurgeAPI::MessageParams] Payload for creating a message. Either an attachment or the body must be given.
50
40
  #
51
41
  # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
52
42
  #
@@ -55,6 +45,11 @@ module SurgeAPI
55
45
  # @see SurgeAPI::Models::MessageCreateParams
56
46
  def create(account_id, params)
57
47
  parsed, options = SurgeAPI::MessageCreateParams.dump_request(params)
48
+ case parsed
49
+ in {message_params: Hash => union, **rest}
50
+ parsed = {**rest, **union}
51
+ else
52
+ end
58
53
  @client.request(
59
54
  method: :post,
60
55
  path: ["accounts/%1$s/messages", account_id],
@@ -64,6 +59,26 @@ module SurgeAPI
64
59
  )
65
60
  end
66
61
 
62
+ # Retrieves a Message object.
63
+ #
64
+ # @overload retrieve(id, request_options: {})
65
+ #
66
+ # @param id [String] The ID of the message to retrieve.
67
+ #
68
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
69
+ #
70
+ # @return [SurgeAPI::Models::Message]
71
+ #
72
+ # @see SurgeAPI::Models::MessageRetrieveParams
73
+ def retrieve(id, params = {})
74
+ @client.request(
75
+ method: :get,
76
+ path: ["messages/%1$s", id],
77
+ model: SurgeAPI::Message,
78
+ options: params[:request_options]
79
+ )
80
+ end
81
+
67
82
  # @api private
68
83
  #
69
84
  # @param client [SurgeAPI::Client]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -3,12 +3,14 @@
3
3
  # Standard libraries.
4
4
  # rubocop:disable Lint/RedundantRequireStatement
5
5
  require "English"
6
+ require "base64"
6
7
  require "cgi"
7
8
  require "date"
8
9
  require "erb"
9
10
  require "etc"
10
11
  require "json"
11
12
  require "net/http"
13
+ require "openssl"
12
14
  require "pathname"
13
15
  require "rbconfig"
14
16
  require "securerandom"
@@ -50,6 +52,8 @@ require_relative "surge_api/errors"
50
52
  require_relative "surge_api/internal/transport/base_client"
51
53
  require_relative "surge_api/internal/transport/pooled_net_requester"
52
54
  require_relative "surge_api/client"
55
+ require_relative "surge_api/models/campaign_params"
56
+ require_relative "surge_api/models/message_params"
53
57
  require_relative "surge_api/models/account"
54
58
  require_relative "surge_api/models/account_create_params"
55
59
  require_relative "surge_api/models/account_retrieve_status_params"
@@ -74,6 +78,7 @@ require_relative "surge_api/models/message_create_params"
74
78
  require_relative "surge_api/models/message_delivered_webhook_event"
75
79
  require_relative "surge_api/models/message_failed_webhook_event"
76
80
  require_relative "surge_api/models/message_received_webhook_event"
81
+ require_relative "surge_api/models/message_retrieve_params"
77
82
  require_relative "surge_api/models/message_sent_webhook_event"
78
83
  require_relative "surge_api/models/organization"
79
84
  require_relative "surge_api/models/phone_number"
data/manifest.yaml CHANGED
@@ -1,11 +1,13 @@
1
1
  dependencies:
2
2
  - English
3
+ - base64
3
4
  - cgi
4
5
  - date
5
6
  - erb
6
7
  - etc
7
8
  - json
8
9
  - net/http
10
+ - openssl
9
11
  - pathname
10
12
  - rbconfig
11
13
  - securerandom
@@ -176,6 +176,11 @@ module SurgeAPI
176
176
  private def auth_headers
177
177
  end
178
178
 
179
+ # @api private
180
+ sig { returns(String) }
181
+ private def user_agent
182
+ end
183
+
179
184
  # @api private
180
185
  sig { returns(String) }
181
186
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module SurgeAPI
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module SurgeAPI
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: SurgeAPI::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -274,9 +274,13 @@ module SurgeAPI
274
274
 
275
275
  # Create a new instance of a model.
276
276
  sig do
277
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
278
- T.attached_class
279
- )
277
+ params(
278
+ data:
279
+ T.any(
280
+ T::Hash[Symbol, T.anything],
281
+ SurgeAPI::Internal::Type::BaseModel
282
+ )
283
+ ).returns(T.attached_class)
280
284
  end
281
285
  def self.new(data = {})
282
286
  end
@@ -112,8 +112,11 @@ module SurgeAPI
112
112
  end
113
113
  attr_writer :address
114
114
 
115
- # An object representing an individual who can be contacted if the carriers have
116
- # any questions about the business.
115
+ # An object representing an individual who can be contacted if Surge or our
116
+ # carrier partners have any questions about the business. If you are registering
117
+ # on behalf of your customer, this must be a contact from your customer's company
118
+ # rather than your own. The individual will likely never be contacted unless there
119
+ # are issues with spam.
117
120
  sig do
118
121
  returns(
119
122
  T.nilable(SurgeAPI::AccountCreateParams::Organization::Contact)
@@ -269,8 +272,11 @@ module SurgeAPI
269
272
  def self.new(
270
273
  # The address of the organization's headquarters.
271
274
  address: nil,
272
- # An object representing an individual who can be contacted if the carriers have
273
- # any questions about the business.
275
+ # An object representing an individual who can be contacted if Surge or our
276
+ # carrier partners have any questions about the business. If you are registering
277
+ # on behalf of your customer, this must be a contact from your customer's company
278
+ # rather than your own. The individual will likely never be contacted unless there
279
+ # are issues with spam.
274
280
  contact: nil,
275
281
  # The two character ISO 3166 country code for the country in which the
276
282
  # organization is headquartered.
@@ -455,7 +461,8 @@ module SurgeAPI
455
461
  # using the same domain name as the website URL will be preferred (e.g. with a
456
462
  # website domain of `https://dtprecisionauto.com`, an email like
457
463
  # `dom@dtprecisionauto.com` will be preferred over one like
458
- # `dom@anothergarage.com` or `dom.toretto@gmail.com`)
464
+ # `dom@anothergarage.com` or `dom.toretto@gmail.com`. `dtprecisionauto@gmail.com`
465
+ # would also be acceptable, but not preferred)
459
466
  sig { returns(T.nilable(String)) }
460
467
  attr_accessor :email
461
468
 
@@ -486,8 +493,11 @@ module SurgeAPI
486
493
  sig { returns(T.nilable(String)) }
487
494
  attr_accessor :title_other
488
495
 
489
- # An object representing an individual who can be contacted if the carriers have
490
- # any questions about the business.
496
+ # An object representing an individual who can be contacted if Surge or our
497
+ # carrier partners have any questions about the business. If you are registering
498
+ # on behalf of your customer, this must be a contact from your customer's company
499
+ # rather than your own. The individual will likely never be contacted unless there
500
+ # are issues with spam.
491
501
  sig do
492
502
  params(
493
503
  email: T.nilable(String),
@@ -506,7 +516,8 @@ module SurgeAPI
506
516
  # using the same domain name as the website URL will be preferred (e.g. with a
507
517
  # website domain of `https://dtprecisionauto.com`, an email like
508
518
  # `dom@dtprecisionauto.com` will be preferred over one like
509
- # `dom@anothergarage.com` or `dom.toretto@gmail.com`)
519
+ # `dom@anothergarage.com` or `dom.toretto@gmail.com`. `dtprecisionauto@gmail.com`
520
+ # would also be acceptable, but not preferred)
510
521
  email: nil,
511
522
  # The first name (or given name) of the individual
512
523
  first_name: nil,
@@ -113,8 +113,11 @@ module SurgeAPI
113
113
  end
114
114
  attr_writer :address
115
115
 
116
- # An object representing an individual who can be contacted if the carriers have
117
- # any questions about the business.
116
+ # An object representing an individual who can be contacted if Surge or our
117
+ # carrier partners have any questions about the business. If you are registering
118
+ # on behalf of your customer, this must be a contact from your customer's company
119
+ # rather than your own. The individual will likely never be contacted unless there
120
+ # are issues with spam.
118
121
  sig do
119
122
  returns(
120
123
  T.nilable(SurgeAPI::AccountUpdateParams::Organization::Contact)
@@ -270,8 +273,11 @@ module SurgeAPI
270
273
  def self.new(
271
274
  # The address of the organization's headquarters.
272
275
  address: nil,
273
- # An object representing an individual who can be contacted if the carriers have
274
- # any questions about the business.
276
+ # An object representing an individual who can be contacted if Surge or our
277
+ # carrier partners have any questions about the business. If you are registering
278
+ # on behalf of your customer, this must be a contact from your customer's company
279
+ # rather than your own. The individual will likely never be contacted unless there
280
+ # are issues with spam.
275
281
  contact: nil,
276
282
  # The two character ISO 3166 country code for the country in which the
277
283
  # organization is headquartered.
@@ -456,7 +462,8 @@ module SurgeAPI
456
462
  # using the same domain name as the website URL will be preferred (e.g. with a
457
463
  # website domain of `https://dtprecisionauto.com`, an email like
458
464
  # `dom@dtprecisionauto.com` will be preferred over one like
459
- # `dom@anothergarage.com` or `dom.toretto@gmail.com`)
465
+ # `dom@anothergarage.com` or `dom.toretto@gmail.com`. `dtprecisionauto@gmail.com`
466
+ # would also be acceptable, but not preferred)
460
467
  sig { returns(T.nilable(String)) }
461
468
  attr_accessor :email
462
469
 
@@ -487,8 +494,11 @@ module SurgeAPI
487
494
  sig { returns(T.nilable(String)) }
488
495
  attr_accessor :title_other
489
496
 
490
- # An object representing an individual who can be contacted if the carriers have
491
- # any questions about the business.
497
+ # An object representing an individual who can be contacted if Surge or our
498
+ # carrier partners have any questions about the business. If you are registering
499
+ # on behalf of your customer, this must be a contact from your customer's company
500
+ # rather than your own. The individual will likely never be contacted unless there
501
+ # are issues with spam.
492
502
  sig do
493
503
  params(
494
504
  email: T.nilable(String),
@@ -507,7 +517,8 @@ module SurgeAPI
507
517
  # using the same domain name as the website URL will be preferred (e.g. with a
508
518
  # website domain of `https://dtprecisionauto.com`, an email like
509
519
  # `dom@dtprecisionauto.com` will be preferred over one like
510
- # `dom@anothergarage.com` or `dom.toretto@gmail.com`)
520
+ # `dom@anothergarage.com` or `dom.toretto@gmail.com`. `dtprecisionauto@gmail.com`
521
+ # would also be acceptable, but not preferred)
511
522
  email: nil,
512
523
  # The first name (or given name) of the individual
513
524
  first_name: nil,