Class: Teamsupport::Client
- Inherits:
-
Object
- Object
- Teamsupport::Client
- Defined in:
- lib/teamsupport/client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ String
Provide api_key and api_secret methods for accessing Client API values.
-
#api_secret ⇒ String
Provide api_key and api_secret methods for accessing Client API values.
-
#api_url ⇒ String
Returns api_url string for the Client.
-
#user_agent ⇒ String
Returns user agent string for the Client.
Instance Method Summary collapse
-
#auth ⇒ Hash
Returns authentication hash for the Client.
-
#auth? ⇒ Boolean
Checks for the existence of an authentication hash on the Client.
-
#initialize(options = {}) {|_self| ... } ⇒ Teamsupport::Client
constructor
private
Initializes a new Client object.
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Teamsupport::Client
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes a new Client object
38 39 40 41 42 43 |
# File 'lib/teamsupport/client.rb', line 38 def initialize( = {}) .each do |key, value| instance_variable_set("@#{key}", value) end yield(self) if block_given? end |
Instance Attribute Details
#api_key ⇒ String
Provide api_key and api_secret methods for accessing Client API values
17 18 19 |
# File 'lib/teamsupport/client.rb', line 17 def api_key @api_key end |
#api_secret ⇒ String
Provide api_key and api_secret methods for accessing Client API values
17 18 19 |
# File 'lib/teamsupport/client.rb', line 17 def api_secret @api_secret end |
#api_url ⇒ String
Returns api_url string for the Client
54 55 56 |
# File 'lib/teamsupport/client.rb', line 54 def api_url @api_url ||= 'https://app.teamsupport.com' end |
#user_agent ⇒ String
Returns user agent string for the Client
67 68 69 |
# File 'lib/teamsupport/client.rb', line 67 def user_agent @user_agent ||= "TeamsupportRubyGem/#{Teamsupport::Version}" end |
Instance Method Details
#auth ⇒ Hash
Returns authentication hash for the Client
80 81 82 83 84 85 |
# File 'lib/teamsupport/client.rb', line 80 def auth { user: api_key, password: api_secret, } end |
#auth? ⇒ Boolean
Checks for the existence of an authentication hash on the Client
96 97 98 |
# File 'lib/teamsupport/client.rb', line 96 def auth? auth.values.all? end |