Class: Audd::Client
- Inherits:
-
Object
- Object
- Audd::Client
- Defined in:
- lib/audd/client.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(api_token:, base_url:) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #post(path, fields:, timeout:, file: nil) ⇒ Object
Constructor Details
#initialize(api_token:, base_url:) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/audd/client.rb', line 11 def initialize(api_token:, base_url:) @api_token = api_token @base_url = base_url @http_client = HttpClient.new end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
9 10 11 |
# File 'lib/audd/client.rb', line 9 def api_token @api_token end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
9 10 11 |
# File 'lib/audd/client.rb', line 9 def base_url @base_url end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/audd/client.rb', line 26 def inspect "#<#{self.class.name} base_url=#{base_url.inspect} api_token=[FILTERED]>" end |
#post(path, fields:, timeout:, file: nil) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/audd/client.rb', line 17 def post(path, fields:, timeout:, file: nil) @http_client.post_form( "#{base_url}#{path}", fields: fields.merge("api_token" => api_token), timeout: timeout, file: file ) end |