rcs 1.0.14 → 1.0.16

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.
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "date"
4
+ require_relative "company_category"
4
5
  require_relative "company_additional_websites_item"
5
6
  require_relative "company_additional_emails_item"
6
7
  require_relative "company_additional_phone_numbers_item"
@@ -15,6 +16,8 @@ module Pinnacle
15
16
  attr_reader :created_at
16
17
  # @return [String] The name of the company
17
18
  attr_reader :name
19
+ # @return [Pinnacle::CompanyCategory] The category of the company
20
+ attr_reader :category
18
21
  # @return [String] The address of the company
19
22
  attr_reader :address
20
23
  # @return [String] The Employer Identification Number (EIN) of the company
@@ -49,6 +52,17 @@ module Pinnacle
49
52
  attr_reader :poc_title
50
53
  # @return [String] The email address of the point of contact
51
54
  attr_reader :poc_email
55
+ # @return [String] Explain how users will opt in to receive messages.
56
+ attr_reader :opt_in
57
+ # @return [String] Explain how users will opt out of receiving messages.
58
+ attr_reader :opt_out
59
+ # @return [Array<String>] Please provide the unique keywords to opt out. Each keyword should not contain
60
+ # spaces.
61
+ attr_reader :opt_out_keywords
62
+ # @return [String] Please define what your agent will do.
63
+ attr_reader :agent_use_case
64
+ # @return [String] Please provide some example messages that your agent will send.
65
+ attr_reader :expected_agent_responses
52
66
  # @return [Array<String>] A list of test phone numbers
53
67
  attr_reader :test_numbers
54
68
  # @return [String] The approval status of the company
@@ -70,6 +84,7 @@ module Pinnacle
70
84
  # @param id [Integer] The unique identifier for the company
71
85
  # @param created_at [DateTime] The date and time when the company was created
72
86
  # @param name [String] The name of the company
87
+ # @param category [Pinnacle::CompanyCategory] The category of the company
73
88
  # @param address [String] The address of the company
74
89
  # @param ein [String] The Employer Identification Number (EIN) of the company
75
90
  # @param description [String] A description of the company
@@ -87,6 +102,12 @@ module Pinnacle
87
102
  # @param poc_name [String] The name of the point of contact
88
103
  # @param poc_title [String] The title of the point of contact
89
104
  # @param poc_email [String] The email address of the point of contact
105
+ # @param opt_in [String] Explain how users will opt in to receive messages.
106
+ # @param opt_out [String] Explain how users will opt out of receiving messages.
107
+ # @param opt_out_keywords [Array<String>] Please provide the unique keywords to opt out. Each keyword should not contain
108
+ # spaces.
109
+ # @param agent_use_case [String] Please define what your agent will do.
110
+ # @param expected_agent_responses [String] Please provide some example messages that your agent will send.
90
111
  # @param test_numbers [Array<String>] A list of test phone numbers
91
112
  # @param status [String] The approval status of the company
92
113
  # @param additional_websites [Array<Pinnacle::CompanyAdditionalWebsitesItem>] A list of additional websites
@@ -94,11 +115,12 @@ module Pinnacle
94
115
  # @param additional_phone_numbers [Array<Pinnacle::CompanyAdditionalPhoneNumbersItem>] A list of additional phone numbers
95
116
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
96
117
  # @return [Pinnacle::Company]
97
- def initialize(id: OMIT, created_at: OMIT, name: OMIT, address: OMIT, ein: OMIT, description: OMIT,
98
- brand_color: OMIT, logo_url: OMIT, hero_url: OMIT, primary_website_url: OMIT, primary_website_label: OMIT, primary_phone: OMIT, primary_phone_label: OMIT, primary_email: OMIT, primary_email_label: OMIT, privacy_policy_url: OMIT, tos_url: OMIT, poc_name: OMIT, poc_title: OMIT, poc_email: OMIT, test_numbers: OMIT, status: OMIT, additional_websites: OMIT, additional_emails: OMIT, additional_phone_numbers: OMIT, additional_properties: nil)
118
+ def initialize(id: OMIT, created_at: OMIT, name: OMIT, category: OMIT, address: OMIT, ein: OMIT, description: OMIT,
119
+ brand_color: OMIT, logo_url: OMIT, hero_url: OMIT, primary_website_url: OMIT, primary_website_label: OMIT, primary_phone: OMIT, primary_phone_label: OMIT, primary_email: OMIT, primary_email_label: OMIT, privacy_policy_url: OMIT, tos_url: OMIT, poc_name: OMIT, poc_title: OMIT, poc_email: OMIT, opt_in: OMIT, opt_out: OMIT, opt_out_keywords: OMIT, agent_use_case: OMIT, expected_agent_responses: OMIT, test_numbers: OMIT, status: OMIT, additional_websites: OMIT, additional_emails: OMIT, additional_phone_numbers: OMIT, additional_properties: nil)
99
120
  @id = id if id != OMIT
100
121
  @created_at = created_at if created_at != OMIT
101
122
  @name = name if name != OMIT
123
+ @category = category if category != OMIT
102
124
  @address = address if address != OMIT
103
125
  @ein = ein if ein != OMIT
104
126
  @description = description if description != OMIT
@@ -116,6 +138,11 @@ module Pinnacle
116
138
  @poc_name = poc_name if poc_name != OMIT
117
139
  @poc_title = poc_title if poc_title != OMIT
118
140
  @poc_email = poc_email if poc_email != OMIT
141
+ @opt_in = opt_in if opt_in != OMIT
142
+ @opt_out = opt_out if opt_out != OMIT
143
+ @opt_out_keywords = opt_out_keywords if opt_out_keywords != OMIT
144
+ @agent_use_case = agent_use_case if agent_use_case != OMIT
145
+ @expected_agent_responses = expected_agent_responses if expected_agent_responses != OMIT
119
146
  @test_numbers = test_numbers if test_numbers != OMIT
120
147
  @status = status if status != OMIT
121
148
  @additional_websites = additional_websites if additional_websites != OMIT
@@ -126,6 +153,7 @@ module Pinnacle
126
153
  "id": id,
127
154
  "createdAt": created_at,
128
155
  "name": name,
156
+ "category": category,
129
157
  "address": address,
130
158
  "ein": ein,
131
159
  "description": description,
@@ -143,6 +171,11 @@ module Pinnacle
143
171
  "pocName": poc_name,
144
172
  "pocTitle": poc_title,
145
173
  "pocEmail": poc_email,
174
+ "optIn": opt_in,
175
+ "optOut": opt_out,
176
+ "optOutKeywords": opt_out_keywords,
177
+ "agentUseCase": agent_use_case,
178
+ "expectedAgentResponses": expected_agent_responses,
146
179
  "testNumbers": test_numbers,
147
180
  "status": status,
148
181
  "additionalWebsites": additional_websites,
@@ -163,6 +196,7 @@ module Pinnacle
163
196
  id = parsed_json["id"]
164
197
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
165
198
  name = parsed_json["name"]
199
+ category = parsed_json["category"]
166
200
  address = parsed_json["address"]
167
201
  ein = parsed_json["ein"]
168
202
  description = parsed_json["description"]
@@ -180,6 +214,11 @@ module Pinnacle
180
214
  poc_name = parsed_json["pocName"]
181
215
  poc_title = parsed_json["pocTitle"]
182
216
  poc_email = parsed_json["pocEmail"]
217
+ opt_in = parsed_json["optIn"]
218
+ opt_out = parsed_json["optOut"]
219
+ opt_out_keywords = parsed_json["optOutKeywords"]
220
+ agent_use_case = parsed_json["agentUseCase"]
221
+ expected_agent_responses = parsed_json["expectedAgentResponses"]
183
222
  test_numbers = parsed_json["testNumbers"]
184
223
  status = parsed_json["status"]
185
224
  additional_websites = parsed_json["additionalWebsites"]&.map do |item|
@@ -198,6 +237,7 @@ module Pinnacle
198
237
  id: id,
199
238
  created_at: created_at,
200
239
  name: name,
240
+ category: category,
201
241
  address: address,
202
242
  ein: ein,
203
243
  description: description,
@@ -215,6 +255,11 @@ module Pinnacle
215
255
  poc_name: poc_name,
216
256
  poc_title: poc_title,
217
257
  poc_email: poc_email,
258
+ opt_in: opt_in,
259
+ opt_out: opt_out,
260
+ opt_out_keywords: opt_out_keywords,
261
+ agent_use_case: agent_use_case,
262
+ expected_agent_responses: expected_agent_responses,
218
263
  test_numbers: test_numbers,
219
264
  status: status,
220
265
  additional_websites: additional_websites,
@@ -241,6 +286,7 @@ module Pinnacle
241
286
  obj.id&.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
242
287
  obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
243
288
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
289
+ obj.category&.is_a?(Pinnacle::CompanyCategory) != false || raise("Passed value for field obj.category is not the expected type, validation failed.")
244
290
  obj.address&.is_a?(String) != false || raise("Passed value for field obj.address is not the expected type, validation failed.")
245
291
  obj.ein&.is_a?(String) != false || raise("Passed value for field obj.ein is not the expected type, validation failed.")
246
292
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
@@ -258,6 +304,11 @@ module Pinnacle
258
304
  obj.poc_name&.is_a?(String) != false || raise("Passed value for field obj.poc_name is not the expected type, validation failed.")
259
305
  obj.poc_title&.is_a?(String) != false || raise("Passed value for field obj.poc_title is not the expected type, validation failed.")
260
306
  obj.poc_email&.is_a?(String) != false || raise("Passed value for field obj.poc_email is not the expected type, validation failed.")
307
+ obj.opt_in&.is_a?(String) != false || raise("Passed value for field obj.opt_in is not the expected type, validation failed.")
308
+ obj.opt_out&.is_a?(String) != false || raise("Passed value for field obj.opt_out is not the expected type, validation failed.")
309
+ obj.opt_out_keywords&.is_a?(Array) != false || raise("Passed value for field obj.opt_out_keywords is not the expected type, validation failed.")
310
+ obj.agent_use_case&.is_a?(String) != false || raise("Passed value for field obj.agent_use_case is not the expected type, validation failed.")
311
+ obj.expected_agent_responses&.is_a?(String) != false || raise("Passed value for field obj.expected_agent_responses is not the expected type, validation failed.")
261
312
  obj.test_numbers&.is_a?(Array) != false || raise("Passed value for field obj.test_numbers is not the expected type, validation failed.")
262
313
  obj.status&.is_a?(String) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
263
314
  obj.additional_websites&.is_a?(Array) != false || raise("Passed value for field obj.additional_websites is not the expected type, validation failed.")
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ class CompanyCategory
5
+ ENTERTAINMENT = "Entertainment"
6
+ FINANCE = "Finance"
7
+ FOOD_BEVERAGE = "Food & Beverage"
8
+ GAMES = "Games"
9
+ HEALTH = "Health"
10
+ MISC = "Misc"
11
+ NEWS = "News"
12
+ OTHER = "Other"
13
+ PRODUCTIVITY = "Productivity"
14
+ SHOPPING_RETAIL = "Shopping & Retail"
15
+ SOCIAL = "Social"
16
+ SPORTS = "Sports"
17
+ TRAVEL = "Travel"
18
+ UTILITIES = "Utilities"
19
+ end
20
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "company_category"
3
4
  require "ostruct"
4
5
  require "json"
5
6
 
@@ -7,6 +8,8 @@ module Pinnacle
7
8
  class CompanyDetails
8
9
  # @return [String] The name of the company.
9
10
  attr_reader :name
11
+ # @return [Pinnacle::CompanyCategory] The category of the company.
12
+ attr_reader :category
10
13
  # @return [String] The address of the company.
11
14
  attr_reader :address
12
15
  # @return [String] The EIN (Employer Identification Number) of the company.
@@ -29,6 +32,7 @@ module Pinnacle
29
32
  OMIT = Object.new
30
33
 
31
34
  # @param name [String] The name of the company.
35
+ # @param category [Pinnacle::CompanyCategory] The category of the company.
32
36
  # @param address [String] The address of the company.
33
37
  # @param ein [String] The EIN (Employer Identification Number) of the company.
34
38
  # @param description [String] A description of the company.
@@ -38,8 +42,10 @@ module Pinnacle
38
42
  # @param hero_url [String] URL of the company's hero image.
39
43
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
40
44
  # @return [Pinnacle::CompanyDetails]
41
- def initialize(name:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil)
45
+ def initialize(name:, category:, address:, ein:, description:, brand_color:, logo_url:, hero_url:,
46
+ additional_properties: nil)
42
47
  @name = name
48
+ @category = category
43
49
  @address = address
44
50
  @ein = ein
45
51
  @description = description
@@ -49,6 +55,7 @@ module Pinnacle
49
55
  @additional_properties = additional_properties
50
56
  @_field_set = {
51
57
  "name": name,
58
+ "category": category,
52
59
  "address": address,
53
60
  "ein": ein,
54
61
  "description": description,
@@ -66,6 +73,7 @@ module Pinnacle
66
73
  struct = JSON.parse(json_object, object_class: OpenStruct)
67
74
  parsed_json = JSON.parse(json_object)
68
75
  name = parsed_json["name"]
76
+ category = parsed_json["category"]
69
77
  address = parsed_json["address"]
70
78
  ein = parsed_json["ein"]
71
79
  description = parsed_json["description"]
@@ -74,6 +82,7 @@ module Pinnacle
74
82
  hero_url = parsed_json["heroUrl"]
75
83
  new(
76
84
  name: name,
85
+ category: category,
77
86
  address: address,
78
87
  ein: ein,
79
88
  description: description,
@@ -99,6 +108,7 @@ module Pinnacle
99
108
  # @return [Void]
100
109
  def self.validate_raw(obj:)
101
110
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
111
+ obj.category.is_a?(Pinnacle::CompanyCategory) != false || raise("Passed value for field obj.category is not the expected type, validation failed.")
102
112
  obj.address.is_a?(String) != false || raise("Passed value for field obj.address is not the expected type, validation failed.")
103
113
  obj.ein.is_a?(String) != false || raise("Passed value for field obj.ein is not the expected type, validation failed.")
104
114
  obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "inbound_message_metadata"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Pinnacle
8
+ class InboundActionMessage
9
+ # @return [String]
10
+ attr_reader :message_type
11
+ # @return [String]
12
+ attr_reader :action_title
13
+ # @return [String]
14
+ attr_reader :payload
15
+ # @return [String]
16
+ attr_reader :action_metadata
17
+ # @return [String]
18
+ attr_reader :from
19
+ # @return [String]
20
+ attr_reader :to
21
+ # @return [Pinnacle::InboundMessageMetadata]
22
+ attr_reader :metadata
23
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
24
+ attr_reader :additional_properties
25
+ # @return [Object]
26
+ attr_reader :_field_set
27
+ protected :_field_set
28
+
29
+ OMIT = Object.new
30
+
31
+ # @param message_type [String]
32
+ # @param action_title [String]
33
+ # @param payload [String]
34
+ # @param action_metadata [String]
35
+ # @param from [String]
36
+ # @param to [String]
37
+ # @param metadata [Pinnacle::InboundMessageMetadata]
38
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
39
+ # @return [Pinnacle::InboundActionMessage]
40
+ def initialize(action_title:, from:, to:, message_type: OMIT, payload: OMIT, action_metadata: OMIT, metadata: OMIT,
41
+ additional_properties: nil)
42
+ @message_type = message_type if message_type != OMIT
43
+ @action_title = action_title
44
+ @payload = payload if payload != OMIT
45
+ @action_metadata = action_metadata if action_metadata != OMIT
46
+ @from = from
47
+ @to = to
48
+ @metadata = metadata if metadata != OMIT
49
+ @additional_properties = additional_properties
50
+ @_field_set = {
51
+ "messageType": message_type,
52
+ "actionTitle": action_title,
53
+ "payload": payload,
54
+ "actionMetadata": action_metadata,
55
+ "from": from,
56
+ "to": to,
57
+ "metadata": metadata
58
+ }.reject do |_k, v|
59
+ v == OMIT
60
+ end
61
+ end
62
+
63
+ # Deserialize a JSON object to an instance of InboundActionMessage
64
+ #
65
+ # @param json_object [String]
66
+ # @return [Pinnacle::InboundActionMessage]
67
+ def self.from_json(json_object:)
68
+ struct = JSON.parse(json_object, object_class: OpenStruct)
69
+ parsed_json = JSON.parse(json_object)
70
+ message_type = parsed_json["messageType"]
71
+ action_title = parsed_json["actionTitle"]
72
+ payload = parsed_json["payload"]
73
+ action_metadata = parsed_json["actionMetadata"]
74
+ from = parsed_json["from"]
75
+ to = parsed_json["to"]
76
+ if parsed_json["metadata"].nil?
77
+ metadata = nil
78
+ else
79
+ metadata = parsed_json["metadata"].to_json
80
+ metadata = Pinnacle::InboundMessageMetadata.from_json(json_object: metadata)
81
+ end
82
+ new(
83
+ message_type: message_type,
84
+ action_title: action_title,
85
+ payload: payload,
86
+ action_metadata: action_metadata,
87
+ from: from,
88
+ to: to,
89
+ metadata: metadata,
90
+ additional_properties: struct
91
+ )
92
+ end
93
+
94
+ # Serialize an instance of InboundActionMessage to a JSON object
95
+ #
96
+ # @return [String]
97
+ def to_json(*_args)
98
+ @_field_set&.to_json
99
+ end
100
+
101
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
102
+ # hash and check each fields type against the current object's property
103
+ # definitions.
104
+ #
105
+ # @param obj [Object]
106
+ # @return [Void]
107
+ def self.validate_raw(obj:)
108
+ obj.message_type&.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
109
+ obj.action_title.is_a?(String) != false || raise("Passed value for field obj.action_title is not the expected type, validation failed.")
110
+ obj.payload&.is_a?(String) != false || raise("Passed value for field obj.payload is not the expected type, validation failed.")
111
+ obj.action_metadata&.is_a?(String) != false || raise("Passed value for field obj.action_metadata is not the expected type, validation failed.")
112
+ obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
113
+ obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
114
+ obj.metadata.nil? || Pinnacle::InboundMessageMetadata.validate_raw(obj: obj.metadata)
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "inbound_location_message_coordinates"
4
+ require_relative "inbound_message_metadata"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module Pinnacle
9
+ class InboundLocationMessage
10
+ # @return [String]
11
+ attr_reader :message_type
12
+ # @return [Pinnacle::InboundLocationMessageCoordinates]
13
+ attr_reader :coordinates
14
+ # @return [String]
15
+ attr_reader :from
16
+ # @return [String]
17
+ attr_reader :to
18
+ # @return [Pinnacle::InboundMessageMetadata]
19
+ attr_reader :metadata
20
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
21
+ attr_reader :additional_properties
22
+ # @return [Object]
23
+ attr_reader :_field_set
24
+ protected :_field_set
25
+
26
+ OMIT = Object.new
27
+
28
+ # @param message_type [String]
29
+ # @param coordinates [Pinnacle::InboundLocationMessageCoordinates]
30
+ # @param from [String]
31
+ # @param to [String]
32
+ # @param metadata [Pinnacle::InboundMessageMetadata]
33
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
34
+ # @return [Pinnacle::InboundLocationMessage]
35
+ def initialize(coordinates:, from:, to:, message_type: OMIT, metadata: OMIT, additional_properties: nil)
36
+ @message_type = message_type if message_type != OMIT
37
+ @coordinates = coordinates
38
+ @from = from
39
+ @to = to
40
+ @metadata = metadata if metadata != OMIT
41
+ @additional_properties = additional_properties
42
+ @_field_set = {
43
+ "messageType": message_type,
44
+ "coordinates": coordinates,
45
+ "from": from,
46
+ "to": to,
47
+ "metadata": metadata
48
+ }.reject do |_k, v|
49
+ v == OMIT
50
+ end
51
+ end
52
+
53
+ # Deserialize a JSON object to an instance of InboundLocationMessage
54
+ #
55
+ # @param json_object [String]
56
+ # @return [Pinnacle::InboundLocationMessage]
57
+ def self.from_json(json_object:)
58
+ struct = JSON.parse(json_object, object_class: OpenStruct)
59
+ parsed_json = JSON.parse(json_object)
60
+ message_type = parsed_json["messageType"]
61
+ if parsed_json["coordinates"].nil?
62
+ coordinates = nil
63
+ else
64
+ coordinates = parsed_json["coordinates"].to_json
65
+ coordinates = Pinnacle::InboundLocationMessageCoordinates.from_json(json_object: coordinates)
66
+ end
67
+ from = parsed_json["from"]
68
+ to = parsed_json["to"]
69
+ if parsed_json["metadata"].nil?
70
+ metadata = nil
71
+ else
72
+ metadata = parsed_json["metadata"].to_json
73
+ metadata = Pinnacle::InboundMessageMetadata.from_json(json_object: metadata)
74
+ end
75
+ new(
76
+ message_type: message_type,
77
+ coordinates: coordinates,
78
+ from: from,
79
+ to: to,
80
+ metadata: metadata,
81
+ additional_properties: struct
82
+ )
83
+ end
84
+
85
+ # Serialize an instance of InboundLocationMessage to a JSON object
86
+ #
87
+ # @return [String]
88
+ def to_json(*_args)
89
+ @_field_set&.to_json
90
+ end
91
+
92
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
93
+ # hash and check each fields type against the current object's property
94
+ # definitions.
95
+ #
96
+ # @param obj [Object]
97
+ # @return [Void]
98
+ def self.validate_raw(obj:)
99
+ obj.message_type&.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
100
+ Pinnacle::InboundLocationMessageCoordinates.validate_raw(obj: obj.coordinates)
101
+ obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
102
+ obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
103
+ obj.metadata.nil? || Pinnacle::InboundMessageMetadata.validate_raw(obj: obj.metadata)
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ class InboundLocationMessageCoordinates
8
+ # @return [Float]
9
+ attr_reader :lat
10
+ # @return [Float]
11
+ attr_reader :lng
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param lat [Float]
21
+ # @param lng [Float]
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [Pinnacle::InboundLocationMessageCoordinates]
24
+ def initialize(lat:, lng:, additional_properties: nil)
25
+ @lat = lat
26
+ @lng = lng
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "lat": lat, "lng": lng }
29
+ end
30
+
31
+ # Deserialize a JSON object to an instance of InboundLocationMessageCoordinates
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Pinnacle::InboundLocationMessageCoordinates]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ lat = parsed_json["lat"]
39
+ lng = parsed_json["lng"]
40
+ new(
41
+ lat: lat,
42
+ lng: lng,
43
+ additional_properties: struct
44
+ )
45
+ end
46
+
47
+ # Serialize an instance of InboundLocationMessageCoordinates to a JSON object
48
+ #
49
+ # @return [String]
50
+ def to_json(*_args)
51
+ @_field_set&.to_json
52
+ end
53
+
54
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
55
+ # hash and check each fields type against the current object's property
56
+ # definitions.
57
+ #
58
+ # @param obj [Object]
59
+ # @return [Void]
60
+ def self.validate_raw(obj:)
61
+ obj.lat.is_a?(Float) != false || raise("Passed value for field obj.lat is not the expected type, validation failed.")
62
+ obj.lng.is_a?(Float) != false || raise("Passed value for field obj.lng is not the expected type, validation failed.")
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "media_payload"
4
+ require_relative "inbound_message_metadata"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module Pinnacle
9
+ class InboundMediaMessage
10
+ # @return [String]
11
+ attr_reader :message_type
12
+ # @return [String]
13
+ attr_reader :text
14
+ # @return [Array<Pinnacle::MediaPayload>]
15
+ attr_reader :media_urls
16
+ # @return [String]
17
+ attr_reader :from
18
+ # @return [String]
19
+ attr_reader :to
20
+ # @return [Pinnacle::InboundMessageMetadata]
21
+ attr_reader :metadata
22
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
23
+ attr_reader :additional_properties
24
+ # @return [Object]
25
+ attr_reader :_field_set
26
+ protected :_field_set
27
+
28
+ OMIT = Object.new
29
+
30
+ # @param message_type [String]
31
+ # @param text [String]
32
+ # @param media_urls [Array<Pinnacle::MediaPayload>]
33
+ # @param from [String]
34
+ # @param to [String]
35
+ # @param metadata [Pinnacle::InboundMessageMetadata]
36
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
37
+ # @return [Pinnacle::InboundMediaMessage]
38
+ def initialize(media_urls:, from:, to:, message_type: OMIT, text: OMIT, metadata: OMIT, additional_properties: nil)
39
+ @message_type = message_type if message_type != OMIT
40
+ @text = text if text != OMIT
41
+ @media_urls = media_urls
42
+ @from = from
43
+ @to = to
44
+ @metadata = metadata if metadata != OMIT
45
+ @additional_properties = additional_properties
46
+ @_field_set = {
47
+ "messageType": message_type,
48
+ "text": text,
49
+ "mediaUrls": media_urls,
50
+ "from": from,
51
+ "to": to,
52
+ "metadata": metadata
53
+ }.reject do |_k, v|
54
+ v == OMIT
55
+ end
56
+ end
57
+
58
+ # Deserialize a JSON object to an instance of InboundMediaMessage
59
+ #
60
+ # @param json_object [String]
61
+ # @return [Pinnacle::InboundMediaMessage]
62
+ def self.from_json(json_object:)
63
+ struct = JSON.parse(json_object, object_class: OpenStruct)
64
+ parsed_json = JSON.parse(json_object)
65
+ message_type = parsed_json["messageType"]
66
+ text = parsed_json["text"]
67
+ media_urls = parsed_json["mediaUrls"]&.map do |item|
68
+ item = item.to_json
69
+ Pinnacle::MediaPayload.from_json(json_object: item)
70
+ end
71
+ from = parsed_json["from"]
72
+ to = parsed_json["to"]
73
+ if parsed_json["metadata"].nil?
74
+ metadata = nil
75
+ else
76
+ metadata = parsed_json["metadata"].to_json
77
+ metadata = Pinnacle::InboundMessageMetadata.from_json(json_object: metadata)
78
+ end
79
+ new(
80
+ message_type: message_type,
81
+ text: text,
82
+ media_urls: media_urls,
83
+ from: from,
84
+ to: to,
85
+ metadata: metadata,
86
+ additional_properties: struct
87
+ )
88
+ end
89
+
90
+ # Serialize an instance of InboundMediaMessage to a JSON object
91
+ #
92
+ # @return [String]
93
+ def to_json(*_args)
94
+ @_field_set&.to_json
95
+ end
96
+
97
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
98
+ # hash and check each fields type against the current object's property
99
+ # definitions.
100
+ #
101
+ # @param obj [Object]
102
+ # @return [Void]
103
+ def self.validate_raw(obj:)
104
+ obj.message_type&.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
105
+ obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
106
+ obj.media_urls.is_a?(Array) != false || raise("Passed value for field obj.media_urls is not the expected type, validation failed.")
107
+ obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
108
+ obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
109
+ obj.metadata.nil? || Pinnacle::InboundMessageMetadata.validate_raw(obj: obj.metadata)
110
+ end
111
+ end
112
+ end