rcs 1.0.14 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rcs/company/client.rb +61 -6
- data/lib/rcs/tools/client.rb +207 -0
- data/lib/rcs/tools/types/tools_shorten_url_response.rb +70 -0
- data/lib/rcs/tools/types/tools_upload_url_response.rb +69 -0
- data/lib/rcs/types/company.rb +53 -2
- data/lib/rcs/types/company_category.rb +20 -0
- data/lib/rcs/types/company_details.rb +11 -1
- data/lib/rcs/types/inbound_action_message.rb +117 -0
- data/lib/rcs/types/inbound_location_message.rb +106 -0
- data/lib/rcs/types/inbound_location_message_coordinates.rb +65 -0
- data/lib/rcs/types/inbound_media_message.rb +112 -0
- data/lib/rcs/types/inbound_message.rb +88 -0
- data/lib/rcs/types/inbound_message_message_type.rb +10 -0
- data/lib/rcs/types/inbound_message_metadata.rb +79 -0
- data/lib/rcs/types/inbound_text_message.rb +100 -0
- data/lib/rcs/types/media_payload.rb +65 -0
- data/lib/rcs/types/message_metadata.rb +56 -0
- data/lib/rcs/types/messaging.rb +95 -0
- data/lib/rcs/types/sender_metadata.rb +74 -0
- data/lib/rcs.rb +7 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +15 -0
- metadata +18 -2
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "inbound_message_message_type"
|
4
|
+
require_relative "inbound_message_metadata"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Pinnacle
|
9
|
+
class InboundMessage
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :from
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :to
|
14
|
+
# @return [Pinnacle::InboundMessageMessageType]
|
15
|
+
attr_reader :message_type
|
16
|
+
# @return [Pinnacle::InboundMessageMetadata]
|
17
|
+
attr_reader :metadata
|
18
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
attr_reader :additional_properties
|
20
|
+
# @return [Object]
|
21
|
+
attr_reader :_field_set
|
22
|
+
protected :_field_set
|
23
|
+
|
24
|
+
OMIT = Object.new
|
25
|
+
|
26
|
+
# @param from [String]
|
27
|
+
# @param to [String]
|
28
|
+
# @param message_type [Pinnacle::InboundMessageMessageType]
|
29
|
+
# @param metadata [Pinnacle::InboundMessageMetadata]
|
30
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
31
|
+
# @return [Pinnacle::InboundMessage]
|
32
|
+
def initialize(from:, to:, message_type:, metadata: OMIT, additional_properties: nil)
|
33
|
+
@from = from
|
34
|
+
@to = to
|
35
|
+
@message_type = message_type
|
36
|
+
@metadata = metadata if metadata != OMIT
|
37
|
+
@additional_properties = additional_properties
|
38
|
+
@_field_set = { "from": from, "to": to, "messageType": message_type, "metadata": metadata }.reject do |_k, v|
|
39
|
+
v == OMIT
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Deserialize a JSON object to an instance of InboundMessage
|
44
|
+
#
|
45
|
+
# @param json_object [String]
|
46
|
+
# @return [Pinnacle::InboundMessage]
|
47
|
+
def self.from_json(json_object:)
|
48
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
49
|
+
parsed_json = JSON.parse(json_object)
|
50
|
+
from = parsed_json["from"]
|
51
|
+
to = parsed_json["to"]
|
52
|
+
message_type = parsed_json["messageType"]
|
53
|
+
if parsed_json["metadata"].nil?
|
54
|
+
metadata = nil
|
55
|
+
else
|
56
|
+
metadata = parsed_json["metadata"].to_json
|
57
|
+
metadata = Pinnacle::InboundMessageMetadata.from_json(json_object: metadata)
|
58
|
+
end
|
59
|
+
new(
|
60
|
+
from: from,
|
61
|
+
to: to,
|
62
|
+
message_type: message_type,
|
63
|
+
metadata: metadata,
|
64
|
+
additional_properties: struct
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of InboundMessage to a JSON object
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_json(*_args)
|
72
|
+
@_field_set&.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
76
|
+
# hash and check each fields type against the current object's property
|
77
|
+
# definitions.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
|
83
|
+
obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
|
84
|
+
obj.message_type.is_a?(Pinnacle::InboundMessageMessageType) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
85
|
+
obj.metadata.nil? || Pinnacle::InboundMessageMetadata.validate_raw(obj: obj.metadata)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "sender_metadata"
|
4
|
+
require_relative "message_metadata"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Pinnacle
|
9
|
+
class InboundMessageMetadata
|
10
|
+
# @return [Pinnacle::SenderMetadata]
|
11
|
+
attr_reader :sender
|
12
|
+
# @return [Pinnacle::MessageMetadata]
|
13
|
+
attr_reader :message
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param sender [Pinnacle::SenderMetadata]
|
23
|
+
# @param message [Pinnacle::MessageMetadata]
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
# @return [Pinnacle::InboundMessageMetadata]
|
26
|
+
def initialize(sender: OMIT, message: OMIT, additional_properties: nil)
|
27
|
+
@sender = sender if sender != OMIT
|
28
|
+
@message = message if message != OMIT
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "sender": sender, "message": message }.reject do |_k, v|
|
31
|
+
v == OMIT
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of InboundMessageMetadata
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [Pinnacle::InboundMessageMetadata]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
parsed_json = JSON.parse(json_object)
|
42
|
+
if parsed_json["sender"].nil?
|
43
|
+
sender = nil
|
44
|
+
else
|
45
|
+
sender = parsed_json["sender"].to_json
|
46
|
+
sender = Pinnacle::SenderMetadata.from_json(json_object: sender)
|
47
|
+
end
|
48
|
+
if parsed_json["message"].nil?
|
49
|
+
message = nil
|
50
|
+
else
|
51
|
+
message = parsed_json["message"].to_json
|
52
|
+
message = Pinnacle::MessageMetadata.from_json(json_object: message)
|
53
|
+
end
|
54
|
+
new(
|
55
|
+
sender: sender,
|
56
|
+
message: message,
|
57
|
+
additional_properties: struct
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Serialize an instance of InboundMessageMetadata to a JSON object
|
62
|
+
#
|
63
|
+
# @return [String]
|
64
|
+
def to_json(*_args)
|
65
|
+
@_field_set&.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
69
|
+
# hash and check each fields type against the current object's property
|
70
|
+
# definitions.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Void]
|
74
|
+
def self.validate_raw(obj:)
|
75
|
+
obj.sender.nil? || Pinnacle::SenderMetadata.validate_raw(obj: obj.sender)
|
76
|
+
obj.message.nil? || Pinnacle::MessageMetadata.validate_raw(obj: obj.message)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "inbound_message_metadata"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Pinnacle
|
8
|
+
class InboundTextMessage
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :message_type
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :text
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :from
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :to
|
17
|
+
# @return [Pinnacle::InboundMessageMetadata]
|
18
|
+
attr_reader :metadata
|
19
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
attr_reader :additional_properties
|
21
|
+
# @return [Object]
|
22
|
+
attr_reader :_field_set
|
23
|
+
protected :_field_set
|
24
|
+
|
25
|
+
OMIT = Object.new
|
26
|
+
|
27
|
+
# @param message_type [String]
|
28
|
+
# @param text [String]
|
29
|
+
# @param from [String]
|
30
|
+
# @param to [String]
|
31
|
+
# @param metadata [Pinnacle::InboundMessageMetadata]
|
32
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
# @return [Pinnacle::InboundTextMessage]
|
34
|
+
def initialize(text:, from:, to:, message_type: OMIT, metadata: OMIT, additional_properties: nil)
|
35
|
+
@message_type = message_type if message_type != OMIT
|
36
|
+
@text = text
|
37
|
+
@from = from
|
38
|
+
@to = to
|
39
|
+
@metadata = metadata if metadata != OMIT
|
40
|
+
@additional_properties = additional_properties
|
41
|
+
@_field_set = {
|
42
|
+
"messageType": message_type,
|
43
|
+
"text": text,
|
44
|
+
"from": from,
|
45
|
+
"to": to,
|
46
|
+
"metadata": metadata
|
47
|
+
}.reject do |_k, v|
|
48
|
+
v == OMIT
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Deserialize a JSON object to an instance of InboundTextMessage
|
53
|
+
#
|
54
|
+
# @param json_object [String]
|
55
|
+
# @return [Pinnacle::InboundTextMessage]
|
56
|
+
def self.from_json(json_object:)
|
57
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
58
|
+
parsed_json = JSON.parse(json_object)
|
59
|
+
message_type = parsed_json["messageType"]
|
60
|
+
text = parsed_json["text"]
|
61
|
+
from = parsed_json["from"]
|
62
|
+
to = parsed_json["to"]
|
63
|
+
if parsed_json["metadata"].nil?
|
64
|
+
metadata = nil
|
65
|
+
else
|
66
|
+
metadata = parsed_json["metadata"].to_json
|
67
|
+
metadata = Pinnacle::InboundMessageMetadata.from_json(json_object: metadata)
|
68
|
+
end
|
69
|
+
new(
|
70
|
+
message_type: message_type,
|
71
|
+
text: text,
|
72
|
+
from: from,
|
73
|
+
to: to,
|
74
|
+
metadata: metadata,
|
75
|
+
additional_properties: struct
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Serialize an instance of InboundTextMessage to a JSON object
|
80
|
+
#
|
81
|
+
# @return [String]
|
82
|
+
def to_json(*_args)
|
83
|
+
@_field_set&.to_json
|
84
|
+
end
|
85
|
+
|
86
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
87
|
+
# hash and check each fields type against the current object's property
|
88
|
+
# definitions.
|
89
|
+
#
|
90
|
+
# @param obj [Object]
|
91
|
+
# @return [Void]
|
92
|
+
def self.validate_raw(obj:)
|
93
|
+
obj.message_type&.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
94
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
95
|
+
obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
|
96
|
+
obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
|
97
|
+
obj.metadata.nil? || Pinnacle::InboundMessageMetadata.validate_raw(obj: obj.metadata)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class MediaPayload
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :type
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :url
|
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 type [String]
|
21
|
+
# @param url [String]
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
# @return [Pinnacle::MediaPayload]
|
24
|
+
def initialize(type:, url:, additional_properties: nil)
|
25
|
+
@type = type
|
26
|
+
@url = url
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
@_field_set = { "type": type, "url": url }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deserialize a JSON object to an instance of MediaPayload
|
32
|
+
#
|
33
|
+
# @param json_object [String]
|
34
|
+
# @return [Pinnacle::MediaPayload]
|
35
|
+
def self.from_json(json_object:)
|
36
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
|
+
parsed_json = JSON.parse(json_object)
|
38
|
+
type = parsed_json["type"]
|
39
|
+
url = parsed_json["url"]
|
40
|
+
new(
|
41
|
+
type: type,
|
42
|
+
url: url,
|
43
|
+
additional_properties: struct
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Serialize an instance of MediaPayload 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.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
62
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Pinnacle
|
8
|
+
class MessageMetadata
|
9
|
+
# @return [DateTime]
|
10
|
+
attr_reader :timestamp
|
11
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
attr_reader :additional_properties
|
13
|
+
# @return [Object]
|
14
|
+
attr_reader :_field_set
|
15
|
+
protected :_field_set
|
16
|
+
|
17
|
+
OMIT = Object.new
|
18
|
+
|
19
|
+
# @param timestamp [DateTime]
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
# @return [Pinnacle::MessageMetadata]
|
22
|
+
def initialize(timestamp:, additional_properties: nil)
|
23
|
+
@timestamp = timestamp
|
24
|
+
@additional_properties = additional_properties
|
25
|
+
@_field_set = { "timestamp": timestamp }
|
26
|
+
end
|
27
|
+
|
28
|
+
# Deserialize a JSON object to an instance of MessageMetadata
|
29
|
+
#
|
30
|
+
# @param json_object [String]
|
31
|
+
# @return [Pinnacle::MessageMetadata]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
parsed_json = JSON.parse(json_object)
|
35
|
+
timestamp = (DateTime.parse(parsed_json["timestamp"]) unless parsed_json["timestamp"].nil?)
|
36
|
+
new(timestamp: timestamp, additional_properties: struct)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Serialize an instance of MessageMetadata to a JSON object
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
def to_json(*_args)
|
43
|
+
@_field_set&.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
47
|
+
# hash and check each fields type against the current object's property
|
48
|
+
# definitions.
|
49
|
+
#
|
50
|
+
# @param obj [Object]
|
51
|
+
# @return [Void]
|
52
|
+
def self.validate_raw(obj:)
|
53
|
+
obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class Messaging
|
8
|
+
# @return [String] Explain how users will opt in to receive messages.
|
9
|
+
attr_reader :opt_in
|
10
|
+
# @return [String] Explain how users will opt out of receiving messages.
|
11
|
+
attr_reader :opt_out
|
12
|
+
# @return [Array<String>] Please provide the unique keywords to opt out. Each keyword should not contain
|
13
|
+
# spaces.
|
14
|
+
attr_reader :opt_out_keywords
|
15
|
+
# @return [String] Please define what your agent will do.
|
16
|
+
attr_reader :agent_use_case
|
17
|
+
# @return [String] Please provide some example messages that your agent will send.
|
18
|
+
attr_reader :expected_agent_responses
|
19
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
attr_reader :additional_properties
|
21
|
+
# @return [Object]
|
22
|
+
attr_reader :_field_set
|
23
|
+
protected :_field_set
|
24
|
+
|
25
|
+
OMIT = Object.new
|
26
|
+
|
27
|
+
# @param opt_in [String] Explain how users will opt in to receive messages.
|
28
|
+
# @param opt_out [String] Explain how users will opt out of receiving messages.
|
29
|
+
# @param opt_out_keywords [Array<String>] Please provide the unique keywords to opt out. Each keyword should not contain
|
30
|
+
# spaces.
|
31
|
+
# @param agent_use_case [String] Please define what your agent will do.
|
32
|
+
# @param expected_agent_responses [String] Please provide some example messages that your agent will send.
|
33
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
34
|
+
# @return [Pinnacle::Messaging]
|
35
|
+
def initialize(opt_in:, opt_out:, opt_out_keywords:, agent_use_case:, expected_agent_responses:,
|
36
|
+
additional_properties: nil)
|
37
|
+
@opt_in = opt_in
|
38
|
+
@opt_out = opt_out
|
39
|
+
@opt_out_keywords = opt_out_keywords
|
40
|
+
@agent_use_case = agent_use_case
|
41
|
+
@expected_agent_responses = expected_agent_responses
|
42
|
+
@additional_properties = additional_properties
|
43
|
+
@_field_set = {
|
44
|
+
"optIn": opt_in,
|
45
|
+
"optOut": opt_out,
|
46
|
+
"optOutKeywords": opt_out_keywords,
|
47
|
+
"agentUseCase": agent_use_case,
|
48
|
+
"expectedAgentResponses": expected_agent_responses
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Deserialize a JSON object to an instance of Messaging
|
53
|
+
#
|
54
|
+
# @param json_object [String]
|
55
|
+
# @return [Pinnacle::Messaging]
|
56
|
+
def self.from_json(json_object:)
|
57
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
58
|
+
parsed_json = JSON.parse(json_object)
|
59
|
+
opt_in = parsed_json["optIn"]
|
60
|
+
opt_out = parsed_json["optOut"]
|
61
|
+
opt_out_keywords = parsed_json["optOutKeywords"]
|
62
|
+
agent_use_case = parsed_json["agentUseCase"]
|
63
|
+
expected_agent_responses = parsed_json["expectedAgentResponses"]
|
64
|
+
new(
|
65
|
+
opt_in: opt_in,
|
66
|
+
opt_out: opt_out,
|
67
|
+
opt_out_keywords: opt_out_keywords,
|
68
|
+
agent_use_case: agent_use_case,
|
69
|
+
expected_agent_responses: expected_agent_responses,
|
70
|
+
additional_properties: struct
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Serialize an instance of Messaging to a JSON object
|
75
|
+
#
|
76
|
+
# @return [String]
|
77
|
+
def to_json(*_args)
|
78
|
+
@_field_set&.to_json
|
79
|
+
end
|
80
|
+
|
81
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
82
|
+
# hash and check each fields type against the current object's property
|
83
|
+
# definitions.
|
84
|
+
#
|
85
|
+
# @param obj [Object]
|
86
|
+
# @return [Void]
|
87
|
+
def self.validate_raw(obj:)
|
88
|
+
obj.opt_in.is_a?(String) != false || raise("Passed value for field obj.opt_in is not the expected type, validation failed.")
|
89
|
+
obj.opt_out.is_a?(String) != false || raise("Passed value for field obj.opt_out is not the expected type, validation failed.")
|
90
|
+
obj.opt_out_keywords.is_a?(Array) != false || raise("Passed value for field obj.opt_out_keywords is not the expected type, validation failed.")
|
91
|
+
obj.agent_use_case.is_a?(String) != false || raise("Passed value for field obj.agent_use_case is not the expected type, validation failed.")
|
92
|
+
obj.expected_agent_responses.is_a?(String) != false || raise("Passed value for field obj.expected_agent_responses is not the expected type, validation failed.")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class SenderMetadata
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :city
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :state
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :country
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param city [String]
|
23
|
+
# @param state [String]
|
24
|
+
# @param country [String]
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Pinnacle::SenderMetadata]
|
27
|
+
def initialize(city: OMIT, state: OMIT, country: OMIT, additional_properties: nil)
|
28
|
+
@city = city if city != OMIT
|
29
|
+
@state = state if state != OMIT
|
30
|
+
@country = country if country != OMIT
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "city": city, "state": state, "country": country }.reject do |_k, v|
|
33
|
+
v == OMIT
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of SenderMetadata
|
38
|
+
#
|
39
|
+
# @param json_object [String]
|
40
|
+
# @return [Pinnacle::SenderMetadata]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
city = parsed_json["city"]
|
45
|
+
state = parsed_json["state"]
|
46
|
+
country = parsed_json["country"]
|
47
|
+
new(
|
48
|
+
city: city,
|
49
|
+
state: state,
|
50
|
+
country: country,
|
51
|
+
additional_properties: struct
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Serialize an instance of SenderMetadata to a JSON object
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
def to_json(*_args)
|
59
|
+
@_field_set&.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.city&.is_a?(String) != false || raise("Passed value for field obj.city is not the expected type, validation failed.")
|
70
|
+
obj.state&.is_a?(String) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
71
|
+
obj.country&.is_a?(String) != false || raise("Passed value for field obj.country is not the expected type, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/rcs.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative "types_export"
|
|
5
5
|
require_relative "requests"
|
6
6
|
require_relative "rcs/company/client"
|
7
7
|
require_relative "rcs/send/client"
|
8
|
+
require_relative "rcs/tools/client"
|
8
9
|
require_relative "rcs/types/rcs_functionalities"
|
9
10
|
|
10
11
|
module Pinnacle
|
@@ -13,6 +14,8 @@ module Pinnacle
|
|
13
14
|
attr_reader :company
|
14
15
|
# @return [Pinnacle::SendClient]
|
15
16
|
attr_reader :send
|
17
|
+
# @return [Pinnacle::ToolsClient]
|
18
|
+
attr_reader :tools
|
16
19
|
|
17
20
|
# @param base_url [String]
|
18
21
|
# @param environment [Pinnacle::Environment]
|
@@ -31,6 +34,7 @@ module Pinnacle
|
|
31
34
|
)
|
32
35
|
@company = Pinnacle::CompanyClient.new(request_client: @request_client)
|
33
36
|
@send = Pinnacle::SendClient.new(request_client: @request_client)
|
37
|
+
@tools = Pinnacle::ToolsClient.new(request_client: @request_client)
|
34
38
|
end
|
35
39
|
|
36
40
|
# Retrieve the RCS functionality of a phone number. For example checks if a phone
|
@@ -71,6 +75,8 @@ module Pinnacle
|
|
71
75
|
attr_reader :company
|
72
76
|
# @return [Pinnacle::AsyncSendClient]
|
73
77
|
attr_reader :send
|
78
|
+
# @return [Pinnacle::AsyncToolsClient]
|
79
|
+
attr_reader :tools
|
74
80
|
|
75
81
|
# @param base_url [String]
|
76
82
|
# @param environment [Pinnacle::Environment]
|
@@ -89,6 +95,7 @@ module Pinnacle
|
|
89
95
|
)
|
90
96
|
@company = Pinnacle::AsyncCompanyClient.new(request_client: @async_request_client)
|
91
97
|
@send = Pinnacle::AsyncSendClient.new(request_client: @async_request_client)
|
98
|
+
@tools = Pinnacle::AsyncToolsClient.new(request_client: @async_request_client)
|
92
99
|
end
|
93
100
|
|
94
101
|
# Retrieve the RCS functionality of a phone number. For example checks if a phone
|
data/lib/requests.rb
CHANGED
@@ -43,7 +43,7 @@ module Pinnacle
|
|
43
43
|
|
44
44
|
# @return [Hash{String => String}]
|
45
45
|
def get_headers
|
46
|
-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.
|
46
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.16" }
|
47
47
|
headers["PINNACLE-API-Key"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
48
48
|
headers
|
49
49
|
end
|
@@ -87,7 +87,7 @@ module Pinnacle
|
|
87
87
|
|
88
88
|
# @return [Hash{String => String}]
|
89
89
|
def get_headers
|
90
|
-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.
|
90
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.16" }
|
91
91
|
headers["PINNACLE-API-Key"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
92
92
|
headers
|
93
93
|
end
|
data/lib/types_export.rb
CHANGED
@@ -8,6 +8,8 @@ require_relative "rcs/send/types/rcs_fallback"
|
|
8
8
|
require_relative "rcs/send/types/send_rcs_response"
|
9
9
|
require_relative "rcs/send/types/send_sms_response"
|
10
10
|
require_relative "rcs/send/types/send_mms_response"
|
11
|
+
require_relative "rcs/tools/types/tools_shorten_url_response"
|
12
|
+
require_relative "rcs/tools/types/tools_upload_url_response"
|
11
13
|
require_relative "rcs/types/bad_request_error_body"
|
12
14
|
require_relative "rcs/types/unauthorized_error_body"
|
13
15
|
require_relative "rcs/types/internal_server_error_body"
|
@@ -18,9 +20,11 @@ require_relative "rcs/types/company_additional_websites_item"
|
|
18
20
|
require_relative "rcs/types/company_additional_emails_item"
|
19
21
|
require_relative "rcs/types/company_additional_phone_numbers_item"
|
20
22
|
require_relative "rcs/types/company"
|
23
|
+
require_relative "rcs/types/company_category"
|
21
24
|
require_relative "rcs/types/company_details"
|
22
25
|
require_relative "rcs/types/company_contact"
|
23
26
|
require_relative "rcs/types/point_of_contact"
|
27
|
+
require_relative "rcs/types/messaging"
|
24
28
|
require_relative "rcs/types/additional_website"
|
25
29
|
require_relative "rcs/types/additional_phone_number"
|
26
30
|
require_relative "rcs/types/additional_email"
|
@@ -29,3 +33,14 @@ require_relative "rcs/types/card"
|
|
29
33
|
require_relative "rcs/types/action_type"
|
30
34
|
require_relative "rcs/types/action_lat_long"
|
31
35
|
require_relative "rcs/types/action"
|
36
|
+
require_relative "rcs/types/inbound_message_message_type"
|
37
|
+
require_relative "rcs/types/inbound_message_metadata"
|
38
|
+
require_relative "rcs/types/inbound_message"
|
39
|
+
require_relative "rcs/types/sender_metadata"
|
40
|
+
require_relative "rcs/types/message_metadata"
|
41
|
+
require_relative "rcs/types/inbound_text_message"
|
42
|
+
require_relative "rcs/types/media_payload"
|
43
|
+
require_relative "rcs/types/inbound_media_message"
|
44
|
+
require_relative "rcs/types/inbound_action_message"
|
45
|
+
require_relative "rcs/types/inbound_location_message_coordinates"
|
46
|
+
require_relative "rcs/types/inbound_location_message"
|