Class: Pinnacle::Client
- Inherits:
-
Object
- Object
- Pinnacle::Client
- Defined in:
- lib/rcs.rb
Instance Attribute Summary collapse
- #company ⇒ Pinnacle::CompanyClient readonly
- #send ⇒ Pinnacle::SendClient 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::Client constructor
Constructor Details
#initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) ⇒ Pinnacle::Client
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rcs.rb', line 23 def initialize(api_key:, base_url: nil, environment: Pinnacle::Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) @request_client = Pinnacle::RequestClient.new( base_url: base_url, environment: environment, max_retries: max_retries, timeout_in_seconds: timeout_in_seconds, api_key: api_key ) @company = Pinnacle::CompanyClient.new(request_client: @request_client) @send = Pinnacle::SendClient.new(request_client: @request_client) end |
Instance Attribute Details
#company ⇒ Pinnacle::CompanyClient (readonly)
13 14 15 |
# File 'lib/rcs.rb', line 13 def company @company 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.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rcs.rb', line 50 def get_rcs_functionality(phone_number: nil, request_options: nil) response = @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 || {}), **@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 "#{@request_client.get_url(request_options: )}/rcs_functionality" end Pinnacle::RcsFunctionalities.from_json(json_object: response.body) end |