Class: Wavix::Profile::Config::Client
- Inherits:
-
Object
- Object
- Wavix::Profile::Config::Client
- Defined in:
- lib/wavix/profile/config/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **_params) ⇒ Wavix::Profile::Config::Types::GetConfigResponse
Returns the balance and global limits configured for the authenticated account.
- #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/wavix/profile/config/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **_params) ⇒ Wavix::Profile::Config::Types::GetConfigResponse
Returns the balance and global limits configured for the authenticated account.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/wavix/profile/config/client.rb', line 25 def get(request_options: {}, **_params) request = Wavix::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v1/profile/config", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Wavix::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Wavix::Profile::Config::Types::GetConfigResponse.load(response.body) else error_class = Wavix::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |