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, post, xml_body
Constructor Details
#initialize(domain, api_token) ⇒ TokenClient
Returns a new instance of TokenClient.
164 165 166 167 168 |
# File 'lib/freshbooks.rb', line 164 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
170 171 172 173 174 |
# File 'lib/freshbooks.rb', line 170 def auth { 'Authorization' => # taken from lib/net/http.rb 'Basic ' + ["#{@username}:#{@password}"].pack('m').delete("\r\n") } end |