Class: Pinnacle::Rcs::Client
- Inherits:
-
Object
- Object
- Pinnacle::Rcs::Client
- Defined in:
- lib/pinnacle/rcs/client.rb
Instance Method Summary collapse
- #agents ⇒ Pinnacle::Agents::Client
-
#get_agent(request_options: {}, **params) ⇒ Pinnacle::Types::RcsAgentResponse
Retrieve details of an RCS agent by its ID.
-
#get_capabilities(request_options: {}, **params) ⇒ Hash[String, Pinnacle::Types::RcsCapability, nil]
Check RCS capabilities for one or more phone numbers.
-
#get_link(request_options: {}, **params) ⇒ Pinnacle::Types::RcsLinkResult
Generate a link for initiating an RCS conversation with your agent.
- #initialize(client:) ⇒ void constructor
- #test ⇒ Pinnacle::Test::Client
- #whitelisted_numbers ⇒ Pinnacle::WhitelistedNumbers::Client
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/pinnacle/rcs/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#agents ⇒ Pinnacle::Agents::Client
125 126 127 |
# File 'lib/pinnacle/rcs/client.rb', line 125 def agents @agents ||= Pinnacle::Rcs::Agents::Client.new(client: @client) end |
#get_agent(request_options: {}, **params) ⇒ Pinnacle::Types::RcsAgentResponse
Retrieve details of an RCS agent by its ID.
Returns the agent’s configuration including display name, description, logo, hero image, contact information, and other settings.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pinnacle/rcs/client.rb', line 28 def get_agent(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "rcs/#{params[:agent_id]}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::RcsAgentResponse.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_capabilities(request_options: {}, **params) ⇒ Hash[String, Pinnacle::Types::RcsCapability, nil]
Check RCS capabilities for one or more phone numbers.
This endpoint allows you to verify which RCS features (cards, buttons, etc.) are supported on specific phone numbers before sending RCS messages to them.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/pinnacle/rcs/client.rb', line 64 def get_capabilities(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "rcs/capabilities", body: Pinnacle::Rcs::Types::RcsCapabilitiesQuery.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::RcsCapabilitiesResult.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_link(request_options: {}, **params) ⇒ Pinnacle::Types::RcsLinkResult
Generate a link for initiating an RCS conversation with your agent.
Users can click these links to start conversations with your RCS agent directly from websites, emails, or other applications.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/pinnacle/rcs/client.rb', line 101 def get_link(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "rcs/link", body: Pinnacle::Rcs::Types::RcsLinkRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::RcsLinkResult.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#test ⇒ Pinnacle::Test::Client
135 136 137 |
# File 'lib/pinnacle/rcs/client.rb', line 135 def test @test ||= Pinnacle::Rcs::Test::Client.new(client: @client) end |
#whitelisted_numbers ⇒ Pinnacle::WhitelistedNumbers::Client
130 131 132 |
# File 'lib/pinnacle/rcs/client.rb', line 130 def whitelisted_numbers @whitelisted_numbers ||= Pinnacle::Rcs::WhitelistedNumbers::Client.new(client: @client) end |