Class: Fortnox::API
Class Method Summary collapse
- .connection ⇒ Object
- .establish_connection(opts = {}) ⇒ Object
- .query_parameters ⇒ Object
- .query_parameters=(params = {}) ⇒ Object
- .run(method, call, attributes = {}) ⇒ Object
Class Method Details
.connection ⇒ Object
15 16 17 |
# File 'lib/fortnox/api.rb', line 15 def connection { :token => @@token, :db => @@database } end |
.establish_connection(opts = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/fortnox/api.rb', line 9 def establish_connection(opts={}) @@token = opts[:token] || ENV['fortnox_token'] @@database = opts[:database] || ENV['fortnox_database'] @@query_parameters = connection end |
.query_parameters ⇒ Object
27 28 29 |
# File 'lib/fortnox/api.rb', line 27 def query_parameters @@query_parameters end |
.query_parameters=(params = {}) ⇒ Object
31 32 33 |
# File 'lib/fortnox/api.rb', line 31 def query_parameters=(params={}) @@query_parameters = query_parameters.merge(params) end |
.run(method, call, attributes = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/fortnox/api.rb', line 19 def run(method, call, attributes={}) self.query_parameters = attributes[:query] if attributes[:query] self.send(method, "/#{call.to_s}.php", { :query => query_parameters, :body => {:xml => build_xml(attributes)} }) end |