Class: Pinnacle::AsyncClient
- Inherits:
-
Object
- Object
- Pinnacle::AsyncClient
- Defined in:
- lib/rcs.rb
Instance Attribute Summary collapse
- #company ⇒ Pinnacle::AsyncCompanyClient readonly
- #send ⇒ Pinnacle::AsyncSendClient readonly
Instance Method Summary collapse
-
#get_rcs_functionality(phone_number: nil, request_options: nil) ⇒ Pinnacle::RcsFunctionalities
Retrieve the RCS functionality of a phone number.
- #initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) ⇒ Pinnacle::AsyncClient constructor
Constructor Details
#initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) ⇒ Pinnacle::AsyncClient
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/rcs.rb', line 81 def initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) @async_request_client = Pinnacle::AsyncRequestClient.new( base_url: base_url, environment: environment, max_retries: max_retries, timeout_in_seconds: timeout_in_seconds, api_key: api_key ) @company = Pinnacle::AsyncCompanyClient.new(request_client: @async_request_client) @send = Pinnacle::AsyncSendClient.new(request_client: @async_request_client) end |
Instance Attribute Details
#company ⇒ Pinnacle::AsyncCompanyClient (readonly)
71 72 73 |
# File 'lib/rcs.rb', line 71 def company @company end |
#send ⇒ Pinnacle::AsyncSendClient (readonly)
73 74 75 |
# File 'lib/rcs.rb', line 73 def send @send end |
Instance Method Details
#get_rcs_functionality(phone_number: nil, request_options: nil) ⇒ Pinnacle::RcsFunctionalities
Retrieve the RCS functionality of a phone number. For example checks if a phone
number can receive RCS message and if it can receive RCS carousels.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/rcs.rb', line 108 def get_rcs_functionality(phone_number: nil, request_options: nil) response = @async_request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["PINNACLE-API-Key"] = .api_key unless &.api_key.nil? req.headers = { **(req.headers || {}), **@async_request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "phoneNumber": phone_number }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@async_request_client.get_url(request_options: )}/rcs_functionality" end Pinnacle::RcsFunctionalities.from_json(json_object: response.body) end |