Class: Fortnox::Customer

Inherits:
API
  • Object
show all
Defined in:
lib/fortnox/customer.rb

Class Method Summary collapse

Methods inherited from API

connection, establish_connection, query_parameters, query_parameters=, run

Class Method Details

.create(attributes = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/fortnox/customer.rb', line 4

def create(attributes={})
  attributes = attributes.reject { |k,v| k == :id } if attributes[:id]

  response = run(:post, :set_contact, with_root(attributes))
  response['result'] ? response['result']['id'].to_i : false
end

.update(attributes = {}) ⇒ Object



11
12
13
14
# File 'lib/fortnox/customer.rb', line 11

def update(attributes={})
  response = run :post, :set_contact, with_root(attributes)
  response['result'] ? response['result']['id'].to_i : false
end