fortnox-api 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -29
  3. data/bin/console +8 -0
  4. data/fortnox-api.gemspec +1 -3
  5. data/lib/fortnox/api.rb +49 -14
  6. data/lib/fortnox/api/circular_queue.rb +33 -0
  7. data/lib/fortnox/api/mappers.rb +1 -1
  8. data/lib/fortnox/api/mappers/base.rb +3 -0
  9. data/lib/fortnox/api/models/article.rb +25 -25
  10. data/lib/fortnox/api/models/customer.rb +47 -47
  11. data/lib/fortnox/api/models/document_base.rb +4 -4
  12. data/lib/fortnox/api/repositories/article.rb +3 -4
  13. data/lib/fortnox/api/repositories/base.rb +77 -5
  14. data/lib/fortnox/api/repositories/base/savers.rb +2 -2
  15. data/lib/fortnox/api/repositories/customer.rb +3 -4
  16. data/lib/fortnox/api/repositories/invoice.rb +3 -4
  17. data/lib/fortnox/api/repositories/order.rb +3 -4
  18. data/lib/fortnox/api/repositories/project.rb +3 -3
  19. data/lib/fortnox/api/types/document_row.rb +3 -3
  20. data/lib/fortnox/api/types/model.rb +2 -6
  21. data/lib/fortnox/api/version.rb +1 -1
  22. data/spec/fortnox/api/mappers/base_spec.rb +6 -0
  23. data/spec/fortnox/api/repositories/article_spec.rb +4 -0
  24. data/spec/fortnox/api/repositories/base_spec.rb +348 -0
  25. data/spec/fortnox/api/repositories/customer_spec.rb +4 -0
  26. data/spec/fortnox/api/repositories/invoice_spec.rb +4 -0
  27. data/spec/fortnox/api/repositories/order_spec.rb +4 -0
  28. data/spec/fortnox/api/repositories/project_spec.rb +4 -0
  29. data/spec/fortnox/api/types/examples/document_row.rb +2 -2
  30. data/spec/fortnox/api/types/house_work_types_spec.rb +4 -0
  31. data/spec/fortnox/api_spec.rb +161 -31
  32. data/spec/spec_helper.rb +7 -2
  33. data/spec/support/helpers/configuration_helper.rb +10 -0
  34. metadata +10 -27
  35. data/lib/fortnox/api/base.rb +0 -47
  36. data/lib/fortnox/api/class_methods.rb +0 -30
  37. data/lib/fortnox/api/environment_validation.rb +0 -78
  38. data/spec/fortnox/api/base_spec.rb +0 -167
  39. data/spec/support/helpers/environment_helper.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e05948f9903dea9dc9b90deab6e51a9e610e0bb
4
- data.tar.gz: b7205e9aef5625b36623652e1626c042d2ffedda
3
+ metadata.gz: 1b979be24bb15e6ad393ebbb425e06e0f26e298a
4
+ data.tar.gz: 124791df4924b27d984348b638aaaae196f911b6
5
5
  SHA512:
6
- metadata.gz: 9d6b44d780e5eec9961b9c398f0ce7b289e8381eebb5bf5965e59c3d46cae5667b3a9b96dc9411b87bce6063d3354491c61fa0da7164acf8daa417cc1281cfec
7
- data.tar.gz: a14a4ab461cdda2e0d50dc4851b69494c58744508aab9d065d237349f62dfaa63b0e3e16c413a6e0738cafcae1a4f59d2e516c5333fb3e4fec2766abff0b245e
6
+ metadata.gz: 1d66781985a0957523f8d0a2b2be72fc140b8b956f7e14547f7d7b74ef19cbdc2419f7cc8733796dfb71ce1e3820cded31097f4d8df0fc18cf96284ac6bb0434
7
+ data.tar.gz: 220620630eba8e0e3c73504b5f87b4099d559fb1953870f844d1fa56d223e20376d3707c738e6f951a78e5846938e80e009c5833ad3cdb9b8bdcfa8f7944c1fc
data/README.md CHANGED
@@ -114,44 +114,46 @@ $ gem install fortnox-api
114
114
  # Usage
115
115
 
116
116
  ## Getting an AccessToken
117
- To make calls to the API server you need a `ClientSecret` and an `AccessToken`. When you sign up for an API-account with Fortnox you should get a client secret and an authorization code. To get the access token, that is reusable, you need to do a one time exchange with the API-server and exchange your authorization code for an access token. This can be done in several ways but we provide a method for it in the gem that you can use.
117
+ To make calls to the API server you need a `ClientSecret` and an `AccessToken`. When you sign up for an API-account with Fortnox you should get a client secret and an authorization code. To get the access token, that is reusable, you need to do a one time exchange with the API-server and exchange your authorization code for an access token. For more information about how to get access tokens, see Fortnox developer documentation.
118
118
 
119
- > ​:warning: **Do not do this more than once!** If you try to do the auth code/access token exchange more than once, regardless of method, it will lock your API-account! So if you get the token using curl or whatever do not use this method as well. If your account is not working and you think it might be due to this you will have to contact Fortnox support and have them reset the authorization code for you. If you want to use several access tokens, you need to use a new authorization code for each one of them!
119
+ ## Configuration
120
+ To configure the gem you can use the `configure` block. A `client_secret` and `access_token` (or `access_tokens` in plural, see [Multiple AccessTokens](#multiple-accesstokens)) are required configurations for the gem to work so at the very minimum you will need something like:
120
121
 
121
122
  ```ruby
122
- # Load the special class from the gem. You need to install the gem first ofc.
123
- require 'fortnox/api/access_token'
124
-
125
- Fortnox::API::AccessToken.new(
126
- base_url: 'https://api.fortnox.se/3',
127
- client_secret: 'P5K5wE3Kun', # Replace with your client secret
128
- authorization_code: 'ea3862b1-189c-464b-8e25-1b9702365fa1', # Replace with your auth code
129
- )
123
+ Fortnox::API.configure do |config|
124
+ config.client_secret = 'P5K5wE3Kun'
125
+ config.access_token = '3f08d038-f380-4893-94a0a0-8f6e60e67a'
126
+ end
130
127
  ```
131
- > ​:info: **This will be made into an executable part of the gem for version 1.0
128
+ Before you start using the gem.
132
129
 
133
- This will output a new token like `3f08d038-f380-4893-94a0a0-8f6e60e67a` that is your access token, **save it!** Set it in the environment by following the instructions in the next step.
134
-
135
- ## Environment variables
136
- The authentication for this gem is stored in the environment. See the documentation for your OS to get instructions for how to set environment variables in it.
137
-
138
- You can choose to use the [`dotenv` gem](https://github.com/bkeepers/dotenv) that we include for development but it is NOT recommended to use in production. You should set proper environment variables in production so you don't have to commit the environment file to source control.
130
+ ### Multiple AccessTokens
139
131
 
140
- The environment variables we use are:
141
- ```bash
142
- FORTNOX_API_BASE_URL
143
- FORTNOX_API_CLIENT_SECRET
144
- FORTNOX_API_ACCESS_TOKEN
132
+ Fortnox uses quite low [API rate limits](https://developer.fortnox.se/blog/important-implementation-of-rate-limits/). The limit is for each access token, and according to Fortnox you can use as many tokens as you like to get around this problem. This gem supports handeling multiple access tokens natively. Just set the `access_tokens` (in plural, compared to `access_token` that only takes a String) to a list of strings:
133
+ ```ruby
134
+ Fortnox::API.configure do |config|
135
+ config.client_secret = 'P5K5wE3Kun'
136
+ config.access_tokens ['a78d35hc-j5b1-ga1b-a1h6-h72n74fj5327', 's2b45f67-dh5d-3g5s-2dj5-dku6gn26sh62']
137
+ end
145
138
  ```
146
- Their values should match their name.
147
-
148
- The gem only supports the latest API version, version 3, so base URL should be set to `FORTNOX_API_BASE_URL=https://api.fortnox.se/3/` . Note that Fortnox requires `https`!
139
+ The gem will then automatically rotate between these tokens. In theory you can declare as many as you like. Remember that you will need to use one authorization code to get each token! See Fortnox developer documentation for more information about how to get access tokens.
149
140
 
150
- > ​:info: ** FORTNOX_API_BASE_URL is deprecated and will be gone in version 1.0, it will be static in the gem instead.
141
+ ### AccessTokens for multiple Fortnox accounts
142
+ Yes, we support working with several accounts at once as well. Simply set `access_tokens` to a hash where the keys (called a *token store*) represents different fortnox accounts and the value(s) for a specific key is an array or a string with access token(s) linked to that specific Fortnox account. For instance: `{ account1: ['token1', 'token2'], account2: 'token2' }`. If you provide a `:default` token store, this is used as default by all repositories.
151
143
 
152
- ### Multiple AccessTokens
153
-
154
- Fortnox uses quite low [API rate limits](https://developer.fortnox.se/blog/important-implementation-of-rate-limits/). The limit is for each access token, and according to Fortnox you can use as many tokens as you like to get around this problem. This gem supports multiple access tokens automatically. Just separate them with a comma: `FORTNOX_API_ACCESS_TOKEN=a78d35hc-j5b1-ga1b-a1h6-h72n74fj5327,s2b45f67-dh5d-3g5s-2dj5-dku6gn26sh62` and the gem will automatically rotate between these tokens. In theory you can declare as many as you like. Remember that you will need one authorization code for each token! See Getting an AccessToken above.
144
+ ```ruby
145
+ Fortnox::API.configure do |config|
146
+ config.client_secret = 'P5K5wE3Kun'
147
+ config.access_tokens = {
148
+ default: ['3f08d038-f380-4893-94a0a0-8f6e60e67a', 'a78d35hc-j5b1-ga1b-a1h6-h72n74fj5327'],
149
+ another_account: ['s2b45f67-dh5d-3g5s-2dj5-dku6gn26sh62']
150
+ }
151
+ end
152
+
153
+ Fortnox::API::Repository::Customer.new # Using token store :default
154
+ Fortnox::API::Repository::Customer.new( token_store: :another_account ) # Using token store :another_account
155
+ ```
156
+ The tokens per store are rotated between calls to the backend as well. That way you can create a web app that connects to multiple Fortnox accounts and uses multiple tokens for each account as well.
155
157
 
156
158
  # Usage
157
159
  ## Repositories
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+
5
+ require "pry"
6
+ require "fortnox/api"
7
+
8
+ Pry.start
@@ -18,10 +18,8 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
18
18
  spec.test_files = spec.files.grep(%r{^(spec)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = ['> 2.2', '< 2.4'] # TODO: Gem breaks with Ruby 2.4 or higher. See issue #93.
22
-
21
+ spec.required_ruby_version = '> 2.2'
23
22
  spec.add_dependency "httparty", "~> 0.14.0" # TODO: Temporary lockdown. See issue #103 for more info.
24
- spec.add_dependency "dotenv", "~> 2.0"
25
23
  spec.add_dependency "dry-struct", "~> 0.1"
26
24
  spec.add_dependency "dry-types", "~> 0.8"
27
25
 
@@ -1,15 +1,46 @@
1
1
  require "set"
2
- require "dotenv"
3
2
  require "dry-struct"
4
- require "fortnox/api/base"
3
+ require "fortnox/api/circular_queue"
5
4
  require "fortnox/api/version"
6
5
  require 'logger'
7
6
 
8
- Dotenv.load unless ENV['RUBY_ENV'] == 'test'
9
-
10
7
  module Fortnox
11
8
  module API
12
9
 
10
+ extend Dry::Configurable
11
+
12
+ DEFAULT_CONFIGURATION = {
13
+ base_url: 'https://api.fortnox.se/3/',
14
+ client_secret: nil,
15
+ token_store: {},
16
+ access_token: nil,
17
+ access_tokens: nil,
18
+ debugging: false,
19
+ logger: ->{
20
+ logger = Logger.new(STDOUT)
21
+ logger.level = Logger::WARN
22
+ return logger
23
+ }.call,
24
+ }.freeze
25
+
26
+ setting :base_url, DEFAULT_CONFIGURATION[:base_url]
27
+ setting :client_secret, DEFAULT_CONFIGURATION[:client_secret]
28
+ setting :token_store, DEFAULT_CONFIGURATION[:token_store]
29
+ setting :access_token, DEFAULT_CONFIGURATION[:access_token] do |value|
30
+ next if value == nil # nil is a valid unassigned value
31
+ invalid_access_token_format!(value) unless value.is_a?(String)
32
+ config.token_store = { default: value }
33
+ value
34
+ end
35
+ setting :access_tokens, DEFAULT_CONFIGURATION[:access_tokens] do |value|
36
+ next if value == nil # nil is a valid unassigned value
37
+ invalid_access_tokens_format!(value) unless value.is_a?(Hash) || value.is_a?(Array)
38
+ config.token_store = value.is_a?(Hash) ? value : { default: value }
39
+ value
40
+ end
41
+ setting :debugging, DEFAULT_CONFIGURATION[:debugging], reader: true
42
+ setting :logger, DEFAULT_CONFIGURATION[:logger], reader: true
43
+
13
44
  class Exception < StandardError
14
45
  end
15
46
 
@@ -22,20 +53,24 @@ module Fortnox
22
53
  class MissingAttributeError < Fortnox::API::Exception
23
54
  end
24
55
 
25
- class << self
26
- @debugging = false
27
- @logger = Logger.new(STDOUT)
28
- attr_accessor :debugging
29
- attr_accessor :logger
30
-
31
- @logger.level = Logger::WARN
56
+ class MissingConfiguration < Fortnox::API::Exception
32
57
  end
33
58
 
34
- def self.get_access_token
35
- Base.get_access_token
59
+ Registry = Dry::Container.new
60
+
61
+ def self.invalid_access_token_format!(value)
62
+ raise ArgumentError,
63
+ "expected a String, but "\
64
+ "#{ value.inspect } is a(n) #{ value.class }"
36
65
  end
66
+ private_class_method :invalid_access_token_format!
37
67
 
38
- Registry = Dry::Container.new
68
+ def self.invalid_access_tokens_format!(value)
69
+ raise ArgumentError,
70
+ "expected a Hash or an Array, but "\
71
+ "#{ value.inspect } is a(n) #{ value.class }"
72
+ end
73
+ private_class_method :invalid_access_tokens_format!
39
74
  end
40
75
  end
41
76
 
@@ -0,0 +1,33 @@
1
+ require 'forwardable'
2
+
3
+ module Fortnox
4
+ module API
5
+ class CircularQueue
6
+ extend Forwardable
7
+
8
+ def initialize *items
9
+ @queue = [ *items ]
10
+ @@next_index = random_start_index
11
+ end
12
+
13
+ # support some general Array methods that fit Queues well
14
+ def_delegators :@queue, :new, :[], :size
15
+
16
+ def next
17
+ value = @queue[ @@next_index ]
18
+ if @@next_index == size - 1
19
+ @@next_index = 0
20
+ else
21
+ @@next_index += 1
22
+ end
23
+ return value
24
+ end
25
+
26
+ private
27
+
28
+ def random_start_index
29
+ Random.rand(@queue.size)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -14,7 +14,7 @@ module Fortnox
14
14
  end
15
15
  end
16
16
 
17
- Registry.register( :fixnum, Fortnox::API::Mapper::Identity )
17
+ Registry.register( :integer, Fortnox::API::Mapper::Identity )
18
18
  Registry.register( :int, Fortnox::API::Mapper::Identity )
19
19
  Registry.register( :float, Fortnox::API::Mapper::Identity )
20
20
  Registry.register( :string, Fortnox::API::Mapper::Identity )
@@ -26,6 +26,9 @@ module Fortnox
26
26
  values.first.class
27
27
  end
28
28
 
29
+ # For Ruby < 2.4, make sure we don't pass Bignum and Fixnum around
30
+ klass = Integer if %w(Bignum Fixnum).include?(klass.to_s) # Stringify to avoid warnings on 2.4
31
+
29
32
  klass.name.split('::').last.downcase.to_sym
30
33
  end
31
34
 
@@ -10,16 +10,16 @@ module Fortnox
10
10
  STUB = { description: '' }.freeze
11
11
 
12
12
  #Url Direct URL to the record
13
- attribute :url, Fortnox::API::Types::Nullable::String.with( read_only: true )
13
+ attribute :url, Types::Nullable::String.with( read_only: true )
14
14
 
15
15
  #Active If the article is active
16
- attribute :active, Fortnox::API::Types::Nullable::Boolean
16
+ attribute :active, Types::Nullable::Boolean
17
17
 
18
18
  #ArticleNumber Article number. 50 characters
19
- attribute :article_number, Fortnox::API::Types::Sized::String[ 50 ]
19
+ attribute :article_number, Types::Sized::String[ 50 ]
20
20
 
21
21
  #Bulky If the article is bulky.
22
- attribute :bulky, Fortnox::API::Types::Nullable::Boolean
22
+ attribute :bulky, Types::Nullable::Boolean
23
23
 
24
24
  #ConstructionAccount Account number for construction work (special VAT rules in Sweden).
25
25
  # The number must be of an existing account.
@@ -29,13 +29,13 @@ module Fortnox
29
29
  attribute :depth, Types::Sized::Integer[ 0, 99_999_999 ]
30
30
 
31
31
  #Description The description of the article
32
- attribute :description, Fortnox::API::Types::Sized::String[ 200 ].with( required: true )
32
+ attribute :description, Types::Sized::String[ 200 ].with( required: true )
33
33
 
34
34
  #DisposableQuantity Disposable quantity of the article.
35
- attribute :disposable_quantity, Fortnox::API::Types::Nullable::Float.with( read_only: true )
35
+ attribute :disposable_quantity, Types::Nullable::Float.with( read_only: true )
36
36
 
37
37
  #EAN EAN bar code
38
- attribute :ean, Fortnox::API::Types::Sized::String[ 30 ]
38
+ attribute :ean, Types::Sized::String[ 30 ]
39
39
 
40
40
  #EUAccount Account number for the sales account to EU.
41
41
  # The number must be of an existing account.
@@ -53,71 +53,71 @@ module Fortnox
53
53
  attribute :height, Types::Sized::Integer[ 0, 99_999_999 ]
54
54
 
55
55
  #Housework If the article is housework
56
- attribute :housework, Fortnox::API::Types::Nullable::Boolean
56
+ attribute :housework, Types::Nullable::Boolean
57
57
 
58
58
  #HouseWorkType The type of house work.
59
59
  attribute :house_work_type, Types::HouseWorkType
60
60
 
61
61
  #Manufacturer The manufacturer of the article
62
- attribute :manufacturer, Fortnox::API::Types::Sized::String[ 50 ]
62
+ attribute :manufacturer, Types::Sized::String[ 50 ]
63
63
 
64
64
  #ManufacturerArticleNumber The manufacturer's article number
65
- attribute :manufacturer_article_number, Fortnox::API::Types::Sized::String[ 50 ]
65
+ attribute :manufacturer_article_number, Types::Sized::String[ 50 ]
66
66
 
67
67
  #Note Text note
68
- attribute :note, Fortnox::API::Types::Sized::String[ 10_000 ]
68
+ attribute :note, Types::Sized::String[ 10_000 ]
69
69
 
70
70
  #PurchaseAccount Account number for purchase.
71
71
  # The number must be of an existing account.
72
72
  attribute :purchase_account, Types::Sized::Integer[ 0, 9_999 ]
73
73
 
74
74
  #PurchasePrice Purchase price of the article
75
- attribute :purchase_price, Fortnox::API::Types::Sized::Float[ 0.0, 99_999_999_999_999.9 ]
75
+ attribute :purchase_price, Types::Sized::Float[ 0.0, 99_999_999_999_999.9 ]
76
76
 
77
77
  #QuantityInStock Quantity in stock of the article
78
- attribute :quantity_in_stock, Fortnox::API::Types::Sized::Float[ 0.0, 99_999_999_999_999.9 ]
78
+ attribute :quantity_in_stock, Types::Sized::Float[ 0.0, 99_999_999_999_999.9 ]
79
79
 
80
80
  #ReservedQuantity Reserved quantity of the article
81
- attribute :reserved_quantity, Fortnox::API::Types::Nullable::Float.with( read_only: true )
81
+ attribute :reserved_quantity, Types::Nullable::Float.with( read_only: true )
82
82
 
83
83
  #SalesAccount Account number for the sales account in Sweden.
84
84
  # The number must be of an existing account.
85
85
  attribute :sales_account, Types::Sized::Integer[ 0, 9_999 ]
86
86
 
87
87
  #SalesPrice Price of article for its default price list
88
- attribute :sales_price, Fortnox::API::Types::Nullable::Float.with( read_only: true )
88
+ attribute :sales_price, Types::Nullable::Float.with( read_only: true )
89
89
 
90
90
  #StockGoods If the article is stock goods
91
- attribute :stock_goods, Fortnox::API::Types::Nullable::Boolean
91
+ attribute :stock_goods, Types::Nullable::Boolean
92
92
 
93
93
  #StockPlace Storage place for the article
94
- attribute :stock_place, Fortnox::API::Types::Sized::String[ 100 ]
94
+ attribute :stock_place, Types::Sized::String[ 100 ]
95
95
 
96
96
  #StockValue Value in stock of the article
97
- attribute :stock_value, Fortnox::API::Types::Nullable::Float.with( read_only: true )
97
+ attribute :stock_value, Types::Nullable::Float.with( read_only: true )
98
98
 
99
99
  #StockWarning When to start warning for low quantity in stock
100
- attribute :stock_warning, Fortnox::API::Types::Sized::Float[ 0.0, 99_999_999_999_999.9 ]
100
+ attribute :stock_warning, Types::Sized::Float[ 0.0, 99_999_999_999_999.9 ]
101
101
 
102
102
  #SupplierName Name of the supplier
103
- attribute :supplier_name, Fortnox::API::Types::Nullable::String.with( read_only: true )
103
+ attribute :supplier_name, Types::Nullable::String.with( read_only: true )
104
104
 
105
105
  #SupplierNumber Supplier number for the article.
106
106
  # The number must be of an existing supplier.
107
- attribute :supplier_number, Fortnox::API::Types::Nullable::String
107
+ attribute :supplier_number, Types::Nullable::String
108
108
 
109
109
  #Type The type of the article
110
110
  attribute :type, Types::ArticleType
111
111
 
112
112
  #Unit Unit code for the article.
113
113
  # The code must be of an existing unit.
114
- attribute :unit, Fortnox::API::Types::Nullable::String
114
+ attribute :unit, Types::Nullable::String
115
115
 
116
116
  #VAT VAT percent, this is predefined by the VAT for the sales account
117
- attribute :vat, Fortnox::API::Types::Nullable::Float
117
+ attribute :vat, Types::Nullable::Float
118
118
 
119
119
  #WebshopArticle If the article is a webshop article
120
- attribute :webshop_article, Fortnox::API::Types::Nullable::Boolean
120
+ attribute :webshop_article, Types::Nullable::Boolean
121
121
 
122
122
  #Weight Weight of the article in grams
123
123
  attribute :weight, Types::Sized::Integer[ 0, 99_999_999 ]
@@ -126,7 +126,7 @@ module Fortnox
126
126
  attribute :width, Types::Sized::Integer[ 0, 99_999_999 ]
127
127
 
128
128
  #Expired If the article has expired
129
- attribute :expired, Fortnox::API::Types::Nullable::Boolean
129
+ attribute :expired, Types::Nullable::Boolean
130
130
  end
131
131
  end
132
132
  end
@@ -27,34 +27,34 @@ module Fortnox
27
27
  # )
28
28
 
29
29
  #Url Direct URL to the record
30
- attribute :url, Fortnox::API::Types::Nullable::String.with( read_only: true )
30
+ attribute :url, Types::Nullable::String.with( read_only: true )
31
31
 
32
32
  #Address1 First address of the customer. 1024 characters
33
- attribute :address1, Fortnox::API::Types::Sized::String[ 1024 ]
33
+ attribute :address1, Types::Sized::String[ 1024 ]
34
34
 
35
35
  #Address2 Second address of the customer. 1024 characters
36
- attribute :address2, Fortnox::API::Types::Sized::String[ 1024 ]
36
+ attribute :address2, Types::Sized::String[ 1024 ]
37
37
 
38
38
  #City City of the customer. 1024 characters
39
- attribute :city, Fortnox::API::Types::Sized::String[ 1024 ]
39
+ attribute :city, Types::Sized::String[ 1024 ]
40
40
 
41
41
  #Country Country of the customer. Read-only.
42
- attribute :country, Fortnox::API::Types::Nullable::String.with( read_only: true )
42
+ attribute :country, Types::Nullable::String.with( read_only: true )
43
43
 
44
44
  #Comments Comments. 1024 characters.
45
- attribute :comments, Fortnox::API::Types::Sized::String[ 1024 ]
45
+ attribute :comments, Types::Sized::String[ 1024 ]
46
46
 
47
47
  #Currency Currency of the customer, 3 letters
48
- attribute :currency, Fortnox::API::Types::Currency
48
+ attribute :currency, Types::Currency
49
49
 
50
50
  #CostCenter Cost center of the customer, Cost center in Fortnox
51
- attribute :cost_center, Fortnox::API::Types::Nullable::String
51
+ attribute :cost_center, Types::Nullable::String
52
52
 
53
53
  #CountryCode Country code of the customer, 2 letters
54
- attribute :country_code, Fortnox::API::Types::CountryCode
54
+ attribute :country_code, Types::CountryCode
55
55
 
56
56
  #CustomerNumber Customer number. 1024 characters
57
- attribute :customer_number, Fortnox::API::Types::Sized::String[ 1024 ]
57
+ attribute :customer_number, Types::Sized::String[ 1024 ]
58
58
 
59
59
  #DefaultDeliveryTypes The properties for this object is listed in the table for “Default Delivery Types”.
60
60
  attribute :default_delivery_types, Types::DefaultDeliveryTypes
@@ -63,34 +63,34 @@ module Fortnox
63
63
  attribute :default_templates, Types::DefaultTemplates
64
64
 
65
65
  #DeliveryAddress1 First delivery address of the customer. 1024 characters
66
- attribute :delivery_address1, Fortnox::API::Types::Sized::String[ 1024 ]
66
+ attribute :delivery_address1, Types::Sized::String[ 1024 ]
67
67
 
68
68
  #DeliveryAddress2 Second delivery address of the customer. 1024 characters
69
- attribute :delivery_address2, Fortnox::API::Types::Sized::String[ 1024 ]
69
+ attribute :delivery_address2, Types::Sized::String[ 1024 ]
70
70
 
71
71
  #DeliveryCity Delivery city of the customer. 1024 characters
72
- attribute :delivery_city, Fortnox::API::Types::Sized::String[ 1024 ]
72
+ attribute :delivery_city, Types::Sized::String[ 1024 ]
73
73
 
74
74
  #DeliveryCountry Delivery country of the customer. Read-only.
75
- attribute :delivery_country, Fortnox::API::Types::Nullable::String.with( read_only: true )
75
+ attribute :delivery_country, Types::Nullable::String.with( read_only: true )
76
76
 
77
77
  #DeliveryCountryCode Delivery country code of the customer, 2 letters
78
- attribute :delivery_country_code, Fortnox::API::Types::CountryCode
78
+ attribute :delivery_country_code, Types::CountryCode
79
79
 
80
80
  #DeliveryFax Delivery fax number of the customer. 1024 characters
81
- attribute :delivery_fax, Fortnox::API::Types::Sized::String[ 1024 ]
81
+ attribute :delivery_fax, Types::Sized::String[ 1024 ]
82
82
 
83
83
  #DeliveryName Delivery name of the customer. 1024 characters
84
- attribute :delivery_name, Fortnox::API::Types::Sized::String[ 1024 ]
84
+ attribute :delivery_name, Types::Sized::String[ 1024 ]
85
85
 
86
86
  #DeliveryPhone1 First delivery phone number of the customer. 1024 characters
87
- attribute :delivery_phone1, Fortnox::API::Types::Sized::String[ 1024 ]
87
+ attribute :delivery_phone1, Types::Sized::String[ 1024 ]
88
88
 
89
89
  #DeliveryPhone2 Second delivery phone number of the customer. 1024 characters
90
- attribute :delivery_phone2, Fortnox::API::Types::Sized::String[ 1024 ]
90
+ attribute :delivery_phone2, Types::Sized::String[ 1024 ]
91
91
 
92
92
  #DeliveryZipCode Delivery zip code of the customer. 1024 characters.
93
- attribute :delivery_zip_code, Fortnox::API::Types::Sized::String[ 1024 ]
93
+ attribute :delivery_zip_code, Types::Sized::String[ 1024 ]
94
94
 
95
95
  #Email Email address of the customer. 1024 characters
96
96
  attribute :email, Types::Email
@@ -123,86 +123,86 @@ module Fortnox
123
123
  attribute :email_order_cc, Types::Email
124
124
 
125
125
  #Fax Fax number of the customer. 1024 characters
126
- attribute :fax, Fortnox::API::Types::Sized::String[ 1024 ]
126
+ attribute :fax, Types::Sized::String[ 1024 ]
127
127
 
128
128
  #InvoiceAdministrationFee Invoice administration fee of the customer, 12 digits (incl. decimals).
129
129
  attribute :invoice_administration_fee,
130
- Fortnox::API::Types::Sized::Float[ 0.0, 99_999_999_999.9 ]
130
+ Types::Sized::Float[ 0.0, 99_999_999_999.9 ]
131
131
 
132
132
  #InvoiceDiscount Invoice discount of the customer, 12 digits (incl. decimals)
133
- attribute :invoice_discount, Fortnox::API::Types::Sized::Float[ 0.0, 99_999_999_999.9 ]
133
+ attribute :invoice_discount, Types::Sized::Float[ 0.0, 99_999_999_999.9 ]
134
134
 
135
135
  #InvoiceFreight Invoice freight fee of the customer, 12 digits (incl. decimals)
136
- attribute :invoice_freight, Fortnox::API::Types::Sized::Float[ 0.0, 99_999_999_999.9 ]
136
+ attribute :invoice_freight, Types::Sized::Float[ 0.0, 99_999_999_999.9 ]
137
137
 
138
138
  #InvoiceRemark Invoice remark of the customer. 1024 characters
139
- attribute :invoice_remark, Fortnox::API::Types::Sized::String[ 1024 ]
139
+ attribute :invoice_remark, Types::Sized::String[ 1024 ]
140
140
 
141
141
  #Name Name of the customer, 1024 characters
142
- attribute :name, Fortnox::API::Types::Sized::String[ 1024 ].with( required: true )
142
+ attribute :name, Types::Sized::String[ 1024 ].with( required: true )
143
143
 
144
144
  #OrganisationNumber Organisation number of the customer. 30 characters
145
- attribute :organisation_number, Fortnox::API::Types::Sized::String[ 30 ]
145
+ attribute :organisation_number, Types::Sized::String[ 30 ]
146
146
 
147
147
  #OurReference Our reference of the customer. 50 characters
148
- attribute :our_reference, Fortnox::API::Types::Sized::String[ 50 ]
148
+ attribute :our_reference, Types::Sized::String[ 50 ]
149
149
 
150
150
  #Phone1 First phone number of the customer. 1024 characters
151
- attribute :phone1, Fortnox::API::Types::Sized::String[ 1024 ]
151
+ attribute :phone1, Types::Sized::String[ 1024 ]
152
152
 
153
153
  #Phone2 Second phone number of the customer. 1024 characters
154
- attribute :phone2, Fortnox::API::Types::Sized::String[ 1024 ]
154
+ attribute :phone2, Types::Sized::String[ 1024 ]
155
155
 
156
156
  #PriceList Price list of the customer, Price list in Fortnox
157
- attribute :price_list, Fortnox::API::Types::Nullable::String
157
+ attribute :price_list, Types::Nullable::String
158
158
 
159
159
  #Project Project of the customer, Project in Fortnox
160
- attribute :project, Fortnox::API::Types::Nullable::String
160
+ attribute :project, Types::Nullable::String
161
161
 
162
162
  #SalesAccount Sales account of the customer, 4 digits
163
- attribute :sales_account, Fortnox::API::Types::AccountNumber
163
+ attribute :sales_account, Types::AccountNumber
164
164
 
165
165
  #ShowPriceVATIncluded Show prices with VAT included or not
166
- attribute :show_price_vat_included, Fortnox::API::Types::Nullable::Boolean
166
+ attribute :show_price_vat_included, Types::Nullable::Boolean
167
167
 
168
168
  #TermsOfDeliveryCode Terms of delivery code of the customer
169
- attribute :terms_of_delivery, Fortnox::API::Types::Nullable::String
169
+ attribute :terms_of_delivery, Types::Nullable::String
170
170
 
171
171
  #TermsOfPaymentCode Terms of payment code of the customer
172
- attribute :terms_of_payment, Fortnox::API::Types::Nullable::String
172
+ attribute :terms_of_payment, Types::Nullable::String
173
173
 
174
174
  #Type Customer type, PRIVATE / COMPANY
175
- attribute :type, Fortnox::API::Types::CustomerType
175
+ attribute :type, Types::CustomerType
176
176
 
177
177
  #VATNumber VAT number of the customer
178
- attribute :vat_number, Fortnox::API::Types::Nullable::String
178
+ attribute :vat_number, Types::Nullable::String
179
179
 
180
180
  #VATType VAT type of the customer, SEVAT / SEREVERSEDVAT / EUREVERSEDVAT / EUVAT / EXPORT
181
- attribute :vat_type, Fortnox::API::Types::VATType
181
+ attribute :vat_type, Types::VATType
182
182
 
183
183
  #VisitAddress Visit address of the customer. 128 characters
184
- attribute :visiting_address, Fortnox::API::Types::Sized::String[ 128 ]
184
+ attribute :visiting_address, Types::Sized::String[ 128 ]
185
185
 
186
186
  #VisitCity Visit city of the customer. 128 characters
187
- attribute :visiting_city, Fortnox::API::Types::Sized::String[ 128 ]
187
+ attribute :visiting_city, Types::Sized::String[ 128 ]
188
188
 
189
189
  #VisitCountry Visit country of the customer, read-only
190
- attribute :visiting_country, Fortnox::API::Types::Nullable::String.with( read_only: true )
190
+ attribute :visiting_country, Types::Nullable::String.with( read_only: true )
191
191
 
192
192
  #VisitingCountryCode Code of the visiting country for the customer, 2 letters
193
- attribute :visiting_country_code, Fortnox::API::Types::CountryCode
193
+ attribute :visiting_country_code, Types::CountryCode
194
194
 
195
195
  #VisitZipCode Visit zip code of the customer. 10 characters
196
- attribute :visiting_zip_code, Fortnox::API::Types::Sized::String[ 10 ]
196
+ attribute :visiting_zip_code, Types::Sized::String[ 10 ]
197
197
 
198
198
  #WayOfDeliveryCode Way of delivery code of the customer
199
- attribute :way_of_delivery, Fortnox::API::Types::Nullable::String
199
+ attribute :way_of_delivery, Types::Nullable::String
200
200
 
201
201
  #YourReference Your reference of the customer. 50 characters
202
- attribute :your_reference, Fortnox::API::Types::Sized::String[ 50 ]
202
+ attribute :your_reference, Types::Sized::String[ 50 ]
203
203
 
204
204
  #ZipCode Zip code of the customer. 10 characters
205
- attribute :zip_code, Fortnox::API::Types::Sized::String[ 10 ]
205
+ attribute :zip_code, Types::Sized::String[ 10 ]
206
206
  end
207
207
  end
208
208
  end