Class: Carriots::Client
- Inherits:
-
Object
- Object
- Carriots::Client
- Includes:
- ApiMethods, Configurable, Connection
- Defined in:
- lib/carriots/client.rb
Overview
Client for the Carriot API
Instance Attribute Summary
Attributes included from Configurable
#api_endpoint, #connection_options, #default_media_type, #login, #user_agent, #web_endpoint, #write_api_key
Instance Method Summary collapse
- #default_device ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#inspect ⇒ String
Text representation of the client, masking api_keys.
Methods included from ApiMethods
Methods included from Connection
Methods included from Configurable
#configure, keys, #reset!, #same_options?
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 |
# File 'lib/carriots/client.rb', line 15 def initialize( = {}) # Use options passed in, but fall back to module defaults Carriots::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || Carriots.instance_variable_get(:"@#{key}")) end end |
Instance Method Details
#default_device ⇒ Object
39 40 41 |
# File 'lib/carriots/client.rb', line 39 def default_device "defaultDevice@#{login}.#{login}" end |
#inspect ⇒ String
Text representation of the client, masking api_keys
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/carriots/client.rb', line 26 def inspect inspected = super # mask api_keys # inspected = inspected.gsub! @write_api_key, "*******" if @write_api_key # Only show last 4 of token, secret if @write_api_key inspected = inspected.gsub! @write_api_key, revele_last_n_digit(@write_api_key) end inspected end |