Class: FreshBooks::TokenClient
- Inherits:
-
Object
- Object
- FreshBooks::TokenClient
- Includes:
- Client
- Defined in:
- lib/freshbooks.rb
Overview
Basic Auth client. uses an account’s API token.
Instance Method Summary collapse
- #auth ⇒ Object
-
#initialize(domain, api_token) ⇒ TokenClient
constructor
A new instance of TokenClient.
Methods included from Client
#api_url, build_xml, #method_missing, new, #post, xml_body
Constructor Details
#initialize(domain, api_token) ⇒ TokenClient
Returns a new instance of TokenClient.
119 120 121 122 123 |
# File 'lib/freshbooks.rb', line 119 def initialize(domain, api_token) @domain = domain @username = api_token @password = 'X' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FreshBooks::Client
Instance Method Details
#auth ⇒ Object
125 126 127 128 129 |
# File 'lib/freshbooks.rb', line 125 def auth { 'Authorization' => # taken from lib/net/http.rb 'Basic ' + ["#{@username}:#{@password}"].pack('m').delete("\r\n") } end |