Class: Emvoicer::Services::Blinksale
- Extended by:
- BlinksaleParsing
- Defined in:
- lib/emvoicer/services/blinksale.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#subdomain ⇒ Object
readonly
Returns the value of attribute subdomain.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #auth_params ⇒ Object
- #base_url ⇒ Object
- #client_url(id) ⇒ Object
- #headers ⇒ Object
-
#initialize(subdomain, username, password) ⇒ Blinksale
constructor
A new instance of Blinksale.
- #invoices_url ⇒ Object
Methods included from BlinksaleParsing
extract_client_node, extract_invoice_nodes, parse_client, parse_invoice
Methods inherited from HttpAuth
#authentication_valid?, #request_headers
Methods inherited from Base
#client, extract_client_node, extract_invoice_nodes, #generate_client, #generate_invoice, #handle_client_source, #handle_invoices_source, #invoices, parse_client, parse_invoice, #request, #request_headers
Constructor Details
#initialize(subdomain, username, password) ⇒ Blinksale
Returns a new instance of Blinksale.
10 11 12 13 14 |
# File 'lib/emvoicer/services/blinksale.rb', line 10 def initialize(subdomain, username, password) @subdomain = subdomain @username = username @password = password end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'lib/emvoicer/services/blinksale.rb', line 8 def password @password end |
#subdomain ⇒ Object (readonly)
Returns the value of attribute subdomain.
8 9 10 |
# File 'lib/emvoicer/services/blinksale.rb', line 8 def subdomain @subdomain end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
8 9 10 |
# File 'lib/emvoicer/services/blinksale.rb', line 8 def username @username end |
Class Method Details
.test_authentication_response(response) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/emvoicer/services/blinksale.rb', line 39 def self.test_authentication_response(response) case response when Net::HTTPSuccess then true else false end end |
Instance Method Details
#auth_params ⇒ Object
16 17 18 |
# File 'lib/emvoicer/services/blinksale.rb', line 16 def auth_params [username, password] end |
#base_url ⇒ Object
27 28 29 |
# File 'lib/emvoicer/services/blinksale.rb', line 27 def base_url "https://#{ subdomain }.blinksale.com" end |
#client_url(id) ⇒ Object
35 36 37 |
# File 'lib/emvoicer/services/blinksale.rb', line 35 def client_url(id) base_url + "/clients/#{ id }" end |
#headers ⇒ Object
20 21 22 23 24 25 |
# File 'lib/emvoicer/services/blinksale.rb', line 20 def headers { "Content-Type" => "application/vnd.blinksale+xml", "Accept" => "application/vnd.blinksale+xml" } end |
#invoices_url ⇒ Object
31 32 33 |
# File 'lib/emvoicer/services/blinksale.rb', line 31 def invoices_url base_url + "/invoices" end |