fortnox-api 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +9 -1104
- data/.travis.yml +22 -2
- data/Gemfile +3 -1
- data/Guardfile +4 -2
- data/README.md +2 -2
- data/Rakefile +3 -1
- data/bin/console +17 -3
- data/fortnox-api.gemspec +32 -27
- data/lib/fortnox/api.rb +17 -16
- data/lib/fortnox/api/circular_queue.rb +13 -7
- data/lib/fortnox/api/mappers.rb +29 -25
- data/lib/fortnox/api/mappers/article.rb +7 -6
- data/lib/fortnox/api/mappers/base.rb +18 -16
- data/lib/fortnox/api/mappers/base/from_json.rb +37 -30
- data/lib/fortnox/api/mappers/base/to_json.rb +39 -37
- data/lib/fortnox/api/mappers/customer.rb +7 -7
- data/lib/fortnox/api/mappers/default_delivery_types.rb +4 -2
- data/lib/fortnox/api/mappers/default_templates.rb +5 -4
- data/lib/fortnox/api/mappers/edi_information.rb +5 -4
- data/lib/fortnox/api/mappers/email_information.rb +5 -4
- data/lib/fortnox/api/mappers/invoice.rb +10 -8
- data/lib/fortnox/api/mappers/invoice_row.rb +12 -7
- data/lib/fortnox/api/mappers/order.rb +10 -7
- data/lib/fortnox/api/mappers/order_row.rb +13 -6
- data/lib/fortnox/api/mappers/project.rb +6 -4
- data/lib/fortnox/api/mappers/terms_of_payments.rb +17 -0
- data/lib/fortnox/api/mappers/unit.rb +17 -0
- data/lib/fortnox/api/models.rb +9 -5
- data/lib/fortnox/api/models/article.rb +68 -67
- data/lib/fortnox/api/models/base.rb +52 -36
- data/lib/fortnox/api/models/customer.rb +95 -94
- data/lib/fortnox/api/models/document.rb +186 -0
- data/lib/fortnox/api/models/invoice.rb +44 -44
- data/lib/fortnox/api/models/label.rb +5 -3
- data/lib/fortnox/api/models/order.rb +8 -8
- data/lib/fortnox/api/models/project.rb +10 -8
- data/lib/fortnox/api/models/terms_of_payments.rb +28 -0
- data/lib/fortnox/api/models/unit.rb +24 -0
- data/lib/fortnox/api/repositories.rb +9 -5
- data/lib/fortnox/api/repositories/article.rb +6 -4
- data/lib/fortnox/api/repositories/base.rb +49 -46
- data/lib/fortnox/api/repositories/base/loaders.rb +32 -36
- data/lib/fortnox/api/repositories/base/savers.rb +23 -21
- data/lib/fortnox/api/repositories/customer.rb +6 -4
- data/lib/fortnox/api/repositories/invoice.rb +6 -4
- data/lib/fortnox/api/repositories/order.rb +6 -4
- data/lib/fortnox/api/repositories/project.rb +6 -4
- data/lib/fortnox/api/repositories/terms_of_payments.rb +17 -0
- data/lib/fortnox/api/repositories/unit.rb +17 -0
- data/lib/fortnox/api/request_handling.rb +12 -12
- data/lib/fortnox/api/types.rb +62 -11
- data/lib/fortnox/api/types/default_delivery_types.rb +5 -3
- data/lib/fortnox/api/types/default_templates.rb +3 -1
- data/lib/fortnox/api/types/defaulted.rb +2 -2
- data/lib/fortnox/api/types/document_row.rb +41 -42
- data/lib/fortnox/api/types/edi_information.rb +10 -8
- data/lib/fortnox/api/types/email_information.rb +10 -8
- data/lib/fortnox/api/types/enums.rb +60 -47
- data/lib/fortnox/api/types/invoice_row.rb +8 -8
- data/lib/fortnox/api/types/model.rb +14 -10
- data/lib/fortnox/api/types/nullable.rb +7 -7
- data/lib/fortnox/api/types/order_row.rb +5 -5
- data/lib/fortnox/api/types/required.rb +5 -5
- data/lib/fortnox/api/types/sized.rb +14 -6
- data/lib/fortnox/api/version.rb +3 -1
- data/spec/fortnox/api/mappers/article_spec.rb +3 -1
- data/spec/fortnox/api/mappers/base/from_json_spec.rb +15 -13
- data/spec/fortnox/api/mappers/base/to_json_spec.rb +4 -3
- data/spec/fortnox/api/mappers/base_spec.rb +40 -35
- data/spec/fortnox/api/mappers/contexts/json_conversion.rb +12 -11
- data/spec/fortnox/api/mappers/customer_spec.rb +3 -1
- data/spec/fortnox/api/mappers/default_delivery_types_spec.rb +3 -1
- data/spec/fortnox/api/mappers/edi_information_spec.rb +4 -2
- data/spec/fortnox/api/mappers/email_information_spec.rb +4 -2
- data/spec/fortnox/api/mappers/examples/mapper.rb +17 -9
- data/spec/fortnox/api/mappers/invoice_row_spec.rb +8 -3
- data/spec/fortnox/api/mappers/invoice_spec.rb +4 -1
- data/spec/fortnox/api/mappers/order_row_spec.rb +9 -2
- data/spec/fortnox/api/mappers/order_spec.rb +4 -1
- data/spec/fortnox/api/mappers/project_spec.rb +3 -1
- data/spec/fortnox/api/mappers/terms_of_payments_spec.rb +16 -0
- data/spec/fortnox/api/mappers/unit_spec.rb +57 -0
- data/spec/fortnox/api/models/article_spec.rb +2 -0
- data/spec/fortnox/api/models/base_spec.rb +46 -38
- data/spec/fortnox/api/models/customer_spec.rb +2 -0
- data/spec/fortnox/api/models/examples/document_base.rb +5 -3
- data/spec/fortnox/api/models/examples/model.rb +12 -9
- data/spec/fortnox/api/models/invoice_spec.rb +2 -0
- data/spec/fortnox/api/models/order_spec.rb +2 -0
- data/spec/fortnox/api/models/project_spec.rb +2 -0
- data/spec/fortnox/api/models/terms_of_payments_spec.rb +9 -0
- data/spec/fortnox/api/models/unit_spec.rb +31 -0
- data/spec/fortnox/api/repositories/article_spec.rb +7 -5
- data/spec/fortnox/api/repositories/base_spec.rb +121 -100
- data/spec/fortnox/api/repositories/customer_spec.rb +7 -5
- data/spec/fortnox/api/repositories/examples/all.rb +5 -4
- data/spec/fortnox/api/repositories/examples/find.rb +50 -41
- data/spec/fortnox/api/repositories/examples/only.rb +14 -13
- data/spec/fortnox/api/repositories/examples/save.rb +23 -29
- data/spec/fortnox/api/repositories/examples/save_with_nested_model.rb +11 -11
- data/spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb +11 -10
- data/spec/fortnox/api/repositories/examples/search.rb +15 -15
- data/spec/fortnox/api/repositories/invoice_spec.rb +8 -6
- data/spec/fortnox/api/repositories/order_spec.rb +8 -6
- data/spec/fortnox/api/repositories/project_spec.rb +7 -5
- data/spec/fortnox/api/repositories/terms_of_payments_spec.rb +30 -0
- data/spec/fortnox/api/repositories/unit_spec.rb +34 -0
- data/spec/fortnox/api/types/account_number_spec.rb +12 -9
- data/spec/fortnox/api/types/default_delivery_types_spec.rb +6 -4
- data/spec/fortnox/api/types/edi_information_spec.rb +9 -7
- data/spec/fortnox/api/types/email_information_spec.rb +8 -6
- data/spec/fortnox/api/types/email_spec.rb +27 -14
- data/spec/fortnox/api/types/enums_spec.rb +3 -1
- data/spec/fortnox/api/types/examples/document_row.rb +10 -8
- data/spec/fortnox/api/types/examples/enum.rb +29 -22
- data/spec/fortnox/api/types/examples/types.rb +8 -4
- data/spec/fortnox/api/types/housework_types_spec.rb +68 -0
- data/spec/fortnox/api/types/invoice_row_spec.rb +3 -1
- data/spec/fortnox/api/types/model_spec.rb +12 -9
- data/spec/fortnox/api/types/nullable_spec.rb +8 -6
- data/spec/fortnox/api/types/order_row_spec.rb +4 -2
- data/spec/fortnox/api/types/required_spec.rb +4 -2
- data/spec/fortnox/api/types/sized_spec.rb +18 -16
- data/spec/fortnox/api_spec.rb +45 -43
- data/spec/spec_helper.rb +9 -6
- data/spec/support/helpers.rb +3 -1
- data/spec/support/helpers/configuration_helper.rb +2 -0
- data/spec/support/helpers/dummy_class_helper.rb +7 -8
- data/spec/support/helpers/repository_helper.rb +2 -0
- data/spec/support/helpers/when_performing_helper.rb +3 -1
- data/spec/support/matchers.rb +2 -0
- data/spec/support/matchers/type.rb +3 -1
- data/spec/support/matchers/type/attribute_matcher.rb +15 -14
- data/spec/support/matchers/type/enum_matcher.rb +9 -7
- data/spec/support/matchers/type/have_account_number_matcher.rb +11 -9
- data/spec/support/matchers/type/have_country_code_matcher.rb +6 -4
- data/spec/support/matchers/type/have_currency_matcher.rb +4 -2
- data/spec/support/matchers/type/have_customer_type_matcher.rb +6 -4
- data/spec/support/matchers/type/have_default_delivery_type_matcher.rb +4 -2
- data/spec/support/matchers/type/have_discount_type_matcher.rb +4 -2
- data/spec/support/matchers/type/have_email_matcher.rb +11 -9
- data/spec/support/matchers/type/have_housework_type_matcher.rb +9 -0
- data/spec/support/matchers/type/have_nullable_date_matcher.rb +29 -29
- data/spec/support/matchers/type/have_nullable_matcher.rb +23 -21
- data/spec/support/matchers/type/have_nullable_string_matcher.rb +30 -32
- data/spec/support/matchers/type/have_sized_float_matcher.rb +4 -2
- data/spec/support/matchers/type/have_sized_integer_matcher.rb +4 -2
- data/spec/support/matchers/type/have_sized_string_matcher.rb +16 -15
- data/spec/support/matchers/type/have_vat_type_matcher.rb +4 -2
- data/spec/support/matchers/type/numeric_matcher.rb +25 -23
- data/spec/support/matchers/type/require_attribute_matcher.rb +36 -37
- data/spec/support/matchers/type/type_matcher.rb +18 -16
- data/spec/support/vcr_setup.rb +2 -0
- data/spec/vcr_cassettes/orders/{house_work_type_babysitting.yml → housework_type_babysitting.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_cleaning.yml → housework_type_cleaning.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_construction.yml → housework_type_construction.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_cooking.yml → housework_type_cooking.yml} +7 -7
- data/spec/vcr_cassettes/orders/{house_work_type_electricity.yml → housework_type_electricity.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_gardening.yml → housework_type_gardening.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_glassmetalwork.yml → housework_type_glassmetalwork.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_grounddrainagework.yml → housework_type_grounddrainagework.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_hvac.yml → housework_type_hvac.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_masonry.yml → housework_type_masonry.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_othercare.yml → housework_type_othercare.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_othercosts.yml → housework_type_othercosts.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_paintingwallpapering.yml → housework_type_paintingwallpapering.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_snowplowing.yml → housework_type_snowplowing.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_textileclothing.yml → housework_type_textileclothing.yml} +9 -10
- data/spec/vcr_cassettes/orders/{house_work_type_tutoring.yml → housework_type_tutoring.yml} +7 -7
- data/spec/vcr_cassettes/termsofpayments/all.yml +51 -0
- data/spec/vcr_cassettes/termsofpayments/find_failure.yml +45 -0
- data/spec/vcr_cassettes/termsofpayments/find_id_1.yml +46 -0
- data/spec/vcr_cassettes/termsofpayments/find_new.yml +46 -0
- data/spec/vcr_cassettes/termsofpayments/save_new.yml +45 -0
- data/spec/vcr_cassettes/termsofpayments/save_old.yml +46 -0
- data/spec/vcr_cassettes/units/all.yml +48 -0
- data/spec/vcr_cassettes/units/find_failure.yml +45 -0
- data/spec/vcr_cassettes/units/find_id_1.yml +46 -0
- data/spec/vcr_cassettes/units/find_new.yml +48 -0
- data/spec/vcr_cassettes/units/save_new.yml +47 -0
- data/spec/vcr_cassettes/units/save_old.yml +48 -0
- data/spec/vcr_cassettes/units/save_with_specially_named_attribute.yml +47 -0
- metadata +127 -88
- data/docs/account.rb +0 -59
- data/docs/extraction_script.js +0 -23
- data/docs/generation_script.rb +0 -43
- data/docs/json/account.json +0 -77
- data/lib/fortnox/api/models/document_base.rb +0 -189
- data/spec/fortnox/api/types/house_work_types_spec.rb +0 -64
- data/spec/support/matchers/type/have_house_work_type_matcher.rb +0 -7
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fortnox/api/types'
|
4
|
+
require 'fortnox/api/models/base'
|
3
5
|
|
4
6
|
module Fortnox
|
5
7
|
module API
|
6
8
|
module Model
|
7
9
|
class Customer < Fortnox::API::Model::Base
|
8
|
-
|
9
10
|
UNIQUE_ID = :customer_number
|
10
11
|
STUB = { name: '' }.freeze
|
11
12
|
|
@@ -26,183 +27,183 @@ module Fortnox
|
|
26
27
|
# :hire
|
27
28
|
# )
|
28
29
|
|
29
|
-
#Url
|
30
|
-
attribute :url, Types::Nullable::String.
|
30
|
+
# Url Direct URL to the record
|
31
|
+
attribute :url, Types::Nullable::String.is(:read_only)
|
31
32
|
|
32
|
-
#Address1 First address of the customer. 1024 characters
|
33
|
-
attribute :address1, Types::Sized::String[
|
33
|
+
# Address1 First address of the customer. 1024 characters
|
34
|
+
attribute :address1, Types::Sized::String[1024]
|
34
35
|
|
35
|
-
#Address2 Second address of the customer. 1024 characters
|
36
|
-
attribute :address2, Types::Sized::String[
|
36
|
+
# Address2 Second address of the customer. 1024 characters
|
37
|
+
attribute :address2, Types::Sized::String[1024]
|
37
38
|
|
38
|
-
#City City of the customer. 1024 characters
|
39
|
-
attribute :city, Types::Sized::String[
|
39
|
+
# City City of the customer. 1024 characters
|
40
|
+
attribute :city, Types::Sized::String[1024]
|
40
41
|
|
41
|
-
#Country Country of the customer. Read-only.
|
42
|
-
attribute :country, Types::Nullable::String.
|
42
|
+
# Country Country of the customer. Read-only.
|
43
|
+
attribute :country, Types::Nullable::String.is(:read_only)
|
43
44
|
|
44
|
-
#Comments Comments. 1024 characters.
|
45
|
-
attribute :comments, Types::Sized::String[
|
45
|
+
# Comments Comments. 1024 characters.
|
46
|
+
attribute :comments, Types::Sized::String[1024]
|
46
47
|
|
47
|
-
#Currency Currency of the customer, 3 letters
|
48
|
+
# Currency Currency of the customer, 3 letters
|
48
49
|
attribute :currency, Types::Currency
|
49
50
|
|
50
|
-
#CostCenter Cost center of the customer, Cost center in Fortnox
|
51
|
+
# CostCenter Cost center of the customer, Cost center in Fortnox
|
51
52
|
attribute :cost_center, Types::Nullable::String
|
52
53
|
|
53
|
-
#CountryCode Country code of the customer, 2 letters
|
54
|
+
# CountryCode Country code of the customer, 2 letters
|
54
55
|
attribute :country_code, Types::CountryCode
|
55
56
|
|
56
|
-
#CustomerNumber Customer number. 1024 characters
|
57
|
-
attribute :customer_number, Types::Sized::String[
|
57
|
+
# CustomerNumber Customer number. 1024 characters
|
58
|
+
attribute :customer_number, Types::Sized::String[1024]
|
58
59
|
|
59
|
-
#DefaultDeliveryTypes The properties for this object is listed in the table for
|
60
|
+
# DefaultDeliveryTypes The properties for this object is listed in the table for "Default Delivery Types".
|
60
61
|
attribute :default_delivery_types, Types::DefaultDeliveryTypes
|
61
62
|
|
62
|
-
#The properties for this object is listed in the table for
|
63
|
+
# The properties for this object is listed in the table for "Default Templates".
|
63
64
|
attribute :default_templates, Types::DefaultTemplates
|
64
65
|
|
65
|
-
#DeliveryAddress1 First delivery address of the customer. 1024 characters
|
66
|
-
attribute :delivery_address1, Types::Sized::String[
|
66
|
+
# DeliveryAddress1 First delivery address of the customer. 1024 characters
|
67
|
+
attribute :delivery_address1, Types::Sized::String[1024]
|
67
68
|
|
68
|
-
#DeliveryAddress2 Second delivery address of the customer. 1024 characters
|
69
|
-
attribute :delivery_address2, Types::Sized::String[
|
69
|
+
# DeliveryAddress2 Second delivery address of the customer. 1024 characters
|
70
|
+
attribute :delivery_address2, Types::Sized::String[1024]
|
70
71
|
|
71
|
-
#DeliveryCity Delivery city of the customer. 1024 characters
|
72
|
-
attribute :delivery_city, Types::Sized::String[
|
72
|
+
# DeliveryCity Delivery city of the customer. 1024 characters
|
73
|
+
attribute :delivery_city, Types::Sized::String[1024]
|
73
74
|
|
74
|
-
#DeliveryCountry Delivery country of the customer. Read-only.
|
75
|
-
attribute :delivery_country, Types::Nullable::String.
|
75
|
+
# DeliveryCountry Delivery country of the customer. Read-only.
|
76
|
+
attribute :delivery_country, Types::Nullable::String.is(:read_only)
|
76
77
|
|
77
|
-
#DeliveryCountryCode Delivery country code of the customer, 2 letters
|
78
|
+
# DeliveryCountryCode Delivery country code of the customer, 2 letters
|
78
79
|
attribute :delivery_country_code, Types::CountryCode
|
79
80
|
|
80
|
-
#DeliveryFax Delivery fax number of the customer. 1024 characters
|
81
|
-
attribute :delivery_fax, Types::Sized::String[
|
81
|
+
# DeliveryFax Delivery fax number of the customer. 1024 characters
|
82
|
+
attribute :delivery_fax, Types::Sized::String[1024]
|
82
83
|
|
83
|
-
#DeliveryName Delivery name of the customer. 1024 characters
|
84
|
-
attribute :delivery_name, Types::Sized::String[
|
84
|
+
# DeliveryName Delivery name of the customer. 1024 characters
|
85
|
+
attribute :delivery_name, Types::Sized::String[1024]
|
85
86
|
|
86
|
-
#DeliveryPhone1 First delivery phone number of the customer. 1024 characters
|
87
|
-
attribute :delivery_phone1, Types::Sized::String[
|
87
|
+
# DeliveryPhone1 First delivery phone number of the customer. 1024 characters
|
88
|
+
attribute :delivery_phone1, Types::Sized::String[1024]
|
88
89
|
|
89
|
-
#DeliveryPhone2 Second delivery phone number of the customer. 1024 characters
|
90
|
-
attribute :delivery_phone2, Types::Sized::String[
|
90
|
+
# DeliveryPhone2 Second delivery phone number of the customer. 1024 characters
|
91
|
+
attribute :delivery_phone2, Types::Sized::String[1024]
|
91
92
|
|
92
|
-
#DeliveryZipCode Delivery zip code of the customer. 1024 characters.
|
93
|
-
attribute :delivery_zip_code, Types::Sized::String[
|
93
|
+
# DeliveryZipCode Delivery zip code of the customer. 1024 characters.
|
94
|
+
attribute :delivery_zip_code, Types::Sized::String[1024]
|
94
95
|
|
95
|
-
#Email Email address of the customer. 1024 characters
|
96
|
+
# Email Email address of the customer. 1024 characters
|
96
97
|
attribute :email, Types::Email
|
97
98
|
|
98
|
-
#EmailInvoice Invoice email address of the customer. 1024 characters
|
99
|
+
# EmailInvoice Invoice email address of the customer. 1024 characters
|
99
100
|
attribute :email_invoice, Types::Email
|
100
101
|
|
101
|
-
#EmailInvoiceBCC Invoice BCC email address of the customer. 1024 characters
|
102
|
+
# EmailInvoiceBCC Invoice BCC email address of the customer. 1024 characters
|
102
103
|
attribute :email_invoice_bcc, Types::Email
|
103
104
|
|
104
|
-
#EmailInvoiceCC Invoice CC email address of the customer. 1024 characters
|
105
|
+
# EmailInvoiceCC Invoice CC email address of the customer. 1024 characters
|
105
106
|
attribute :email_invoice_cc, Types::Email
|
106
107
|
|
107
|
-
#EmailOffer Offer email address of the customer. 1024 characters
|
108
|
+
# EmailOffer Offer email address of the customer. 1024 characters
|
108
109
|
attribute :email_offer, Types::Email
|
109
110
|
|
110
|
-
#EmailOfferBCC Offer BCC email address of the customer. 1024 characters
|
111
|
+
# EmailOfferBCC Offer BCC email address of the customer. 1024 characters
|
111
112
|
attribute :email_offer_bcc, Types::Email
|
112
113
|
|
113
|
-
#EmailOfferCC Offer CC email address of the customer. 1024 characters
|
114
|
+
# EmailOfferCC Offer CC email address of the customer. 1024 characters
|
114
115
|
attribute :email_offer_cc, Types::Email
|
115
116
|
|
116
|
-
#EmailOrder Order email address of the customer. 1024 characters
|
117
|
+
# EmailOrder Order email address of the customer. 1024 characters
|
117
118
|
attribute :email_order, Types::Email
|
118
119
|
|
119
|
-
#EmailOrderBCC Order BCC email address of the customer. 1024 characters
|
120
|
+
# EmailOrderBCC Order BCC email address of the customer. 1024 characters
|
120
121
|
attribute :email_order_bcc, Types::Email
|
121
122
|
|
122
|
-
#EmailOrderCC Order CC email address of the customer. 1024 characters
|
123
|
+
# EmailOrderCC Order CC email address of the customer. 1024 characters
|
123
124
|
attribute :email_order_cc, Types::Email
|
124
125
|
|
125
|
-
#Fax Fax number of the customer. 1024 characters
|
126
|
-
attribute :fax, Types::Sized::String[
|
126
|
+
# Fax Fax number of the customer. 1024 characters
|
127
|
+
attribute :fax, Types::Sized::String[1024]
|
127
128
|
|
128
|
-
#InvoiceAdministrationFee Invoice administration fee of the customer, 12 digits (incl. decimals).
|
129
|
+
# InvoiceAdministrationFee Invoice administration fee of the customer, 12 digits (incl. decimals).
|
129
130
|
attribute :invoice_administration_fee,
|
130
|
-
Types::Sized::Float[
|
131
|
+
Types::Sized::Float[0.0, 99_999_999_999.9]
|
131
132
|
|
132
|
-
#InvoiceDiscount Invoice discount of the customer, 12 digits (incl. decimals)
|
133
|
-
attribute :invoice_discount, Types::Sized::Float[
|
133
|
+
# InvoiceDiscount Invoice discount of the customer, 12 digits (incl. decimals)
|
134
|
+
attribute :invoice_discount, Types::Sized::Float[0.0, 99_999_999_999.9]
|
134
135
|
|
135
|
-
#InvoiceFreight Invoice freight fee of the customer, 12 digits (incl. decimals)
|
136
|
-
attribute :invoice_freight, Types::Sized::Float[
|
136
|
+
# InvoiceFreight Invoice freight fee of the customer, 12 digits (incl. decimals)
|
137
|
+
attribute :invoice_freight, Types::Sized::Float[0.0, 99_999_999_999.9]
|
137
138
|
|
138
|
-
#InvoiceRemark Invoice remark of the customer. 1024 characters
|
139
|
-
attribute :invoice_remark, Types::Sized::String[
|
139
|
+
# InvoiceRemark Invoice remark of the customer. 1024 characters
|
140
|
+
attribute :invoice_remark, Types::Sized::String[1024]
|
140
141
|
|
141
|
-
#Name Name of the customer, 1024 characters
|
142
|
-
attribute :name, Types::Sized::String[
|
142
|
+
# Name Name of the customer, 1024 characters
|
143
|
+
attribute :name, Types::Sized::String[1024].is(:required)
|
143
144
|
|
144
|
-
#OrganisationNumber Organisation number of the customer. 30 characters
|
145
|
-
attribute :organisation_number, Types::Sized::String[
|
145
|
+
# OrganisationNumber Organisation number of the customer. 30 characters
|
146
|
+
attribute :organisation_number, Types::Sized::String[30]
|
146
147
|
|
147
|
-
#OurReference Our reference of the customer. 50 characters
|
148
|
-
attribute :our_reference, Types::Sized::String[
|
148
|
+
# OurReference Our reference of the customer. 50 characters
|
149
|
+
attribute :our_reference, Types::Sized::String[50]
|
149
150
|
|
150
|
-
#Phone1 First phone number of the customer. 1024 characters
|
151
|
-
attribute :phone1, Types::Sized::String[
|
151
|
+
# Phone1 First phone number of the customer. 1024 characters
|
152
|
+
attribute :phone1, Types::Sized::String[1024]
|
152
153
|
|
153
|
-
#Phone2 Second phone number of the customer. 1024 characters
|
154
|
-
attribute :phone2, Types::Sized::String[
|
154
|
+
# Phone2 Second phone number of the customer. 1024 characters
|
155
|
+
attribute :phone2, Types::Sized::String[1024]
|
155
156
|
|
156
|
-
#PriceList Price list of the customer, Price list in Fortnox
|
157
|
+
# PriceList Price list of the customer, Price list in Fortnox
|
157
158
|
attribute :price_list, Types::Nullable::String
|
158
159
|
|
159
|
-
#Project Project of the customer, Project in Fortnox
|
160
|
+
# Project Project of the customer, Project in Fortnox
|
160
161
|
attribute :project, Types::Nullable::String
|
161
162
|
|
162
|
-
#SalesAccount Sales account of the customer, 4 digits
|
163
|
+
# SalesAccount Sales account of the customer, 4 digits
|
163
164
|
attribute :sales_account, Types::AccountNumber
|
164
165
|
|
165
|
-
#ShowPriceVATIncluded Show prices with VAT included or not
|
166
|
+
# ShowPriceVATIncluded Show prices with VAT included or not
|
166
167
|
attribute :show_price_vat_included, Types::Nullable::Boolean
|
167
168
|
|
168
|
-
#TermsOfDeliveryCode Terms of delivery code of the customer
|
169
|
+
# TermsOfDeliveryCode Terms of delivery code of the customer
|
169
170
|
attribute :terms_of_delivery, Types::Nullable::String
|
170
171
|
|
171
|
-
#TermsOfPaymentCode Terms of payment code of the customer
|
172
|
+
# TermsOfPaymentCode Terms of payment code of the customer
|
172
173
|
attribute :terms_of_payment, Types::Nullable::String
|
173
174
|
|
174
|
-
#Type Customer type, PRIVATE / COMPANY
|
175
|
+
# Type Customer type, PRIVATE / COMPANY
|
175
176
|
attribute :type, Types::CustomerType
|
176
177
|
|
177
|
-
#VATNumber VAT number of the customer
|
178
|
+
# VATNumber VAT number of the customer
|
178
179
|
attribute :vat_number, Types::Nullable::String
|
179
180
|
|
180
|
-
#VATType VAT type of the customer, SEVAT / SEREVERSEDVAT / EUREVERSEDVAT / EUVAT / EXPORT
|
181
|
+
# VATType VAT type of the customer, SEVAT / SEREVERSEDVAT / EUREVERSEDVAT / EUVAT / EXPORT
|
181
182
|
attribute :vat_type, Types::VATType
|
182
183
|
|
183
|
-
#VisitAddress Visit address of the customer. 128 characters
|
184
|
-
attribute :visiting_address, Types::Sized::String[
|
184
|
+
# VisitAddress Visit address of the customer. 128 characters
|
185
|
+
attribute :visiting_address, Types::Sized::String[128]
|
185
186
|
|
186
|
-
#VisitCity Visit city of the customer. 128 characters
|
187
|
-
attribute :visiting_city, Types::Sized::String[
|
187
|
+
# VisitCity Visit city of the customer. 128 characters
|
188
|
+
attribute :visiting_city, Types::Sized::String[128]
|
188
189
|
|
189
|
-
#VisitCountry Visit country of the customer, read-only
|
190
|
-
attribute :visiting_country, Types::Nullable::String.
|
190
|
+
# VisitCountry Visit country of the customer, read-only
|
191
|
+
attribute :visiting_country, Types::Nullable::String.is(:read_only)
|
191
192
|
|
192
|
-
#VisitingCountryCode Code of the visiting country for the customer, 2 letters
|
193
|
+
# VisitingCountryCode Code of the visiting country for the customer, 2 letters
|
193
194
|
attribute :visiting_country_code, Types::CountryCode
|
194
195
|
|
195
|
-
#VisitZipCode Visit zip code of the customer. 10 characters
|
196
|
-
attribute :visiting_zip_code, Types::Sized::String[
|
196
|
+
# VisitZipCode Visit zip code of the customer. 10 characters
|
197
|
+
attribute :visiting_zip_code, Types::Sized::String[10]
|
197
198
|
|
198
|
-
#WayOfDeliveryCode Way of delivery code of the customer
|
199
|
+
# WayOfDeliveryCode Way of delivery code of the customer
|
199
200
|
attribute :way_of_delivery, Types::Nullable::String
|
200
201
|
|
201
|
-
#YourReference Your reference of the customer. 50 characters
|
202
|
-
attribute :your_reference, Types::Sized::String[
|
202
|
+
# YourReference Your reference of the customer. 50 characters
|
203
|
+
attribute :your_reference, Types::Sized::String[50]
|
203
204
|
|
204
|
-
#ZipCode Zip code of the customer. 10 characters
|
205
|
-
attribute :zip_code, Types::Sized::String[
|
205
|
+
# ZipCode Zip code of the customer. 10 characters
|
206
|
+
attribute :zip_code, Types::Sized::String[10]
|
206
207
|
end
|
207
208
|
end
|
208
209
|
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fortnox/api/types'
|
4
|
+
require 'fortnox/api/models/label'
|
5
|
+
|
6
|
+
module Fortnox
|
7
|
+
module API
|
8
|
+
module Model
|
9
|
+
# This model is the shared attributes for Offer, Order and Invoice, the three "docuemnt models" in Fortnox.
|
10
|
+
# In the Fortnox implementation these are so close together that they are saved in the same database table.
|
11
|
+
# This is never used standalone, only included in the respective models.
|
12
|
+
class Document < Fortnox::API::Model::Base
|
13
|
+
# Url Direct url to the record.
|
14
|
+
attribute :url, Types::Nullable::String.is(:read_only)
|
15
|
+
|
16
|
+
# AdministrationFee The document administration fee.
|
17
|
+
attribute :administration_fee, Types::Nullable::Float
|
18
|
+
|
19
|
+
# AdministrationFeeVAT VAT of the document administration fee.
|
20
|
+
attribute :administration_fee_vat, Types::Nullable::Float.is(:read_only)
|
21
|
+
|
22
|
+
# Address1 Document address 1. 1024 characters
|
23
|
+
attribute :address1, Types::Sized::String[1024]
|
24
|
+
|
25
|
+
# Address2 Document address 2. 1024 characters
|
26
|
+
attribute :address2, Types::Sized::String[1024]
|
27
|
+
|
28
|
+
# BasisTaxReduction Basis of tax reduction.
|
29
|
+
attribute :basis_tax_reduction, Types::Nullable::Float.is(:read_only)
|
30
|
+
|
31
|
+
# Cancelled If the document is cancelled.
|
32
|
+
attribute :cancelled, Types::Nullable::Boolean.is(:read_only)
|
33
|
+
|
34
|
+
# City City for the document address.
|
35
|
+
attribute :city, Types::Sized::String[1024]
|
36
|
+
|
37
|
+
# Comments Comments of the document
|
38
|
+
attribute :comments, Types::Sized::String[1024]
|
39
|
+
|
40
|
+
# ContributionPercent Document contribution in percent.
|
41
|
+
attribute :contribution_percent, Types::Nullable::Float.is(:read_only)
|
42
|
+
|
43
|
+
# ContributionValue Document contribution in amount.
|
44
|
+
attribute :contribution_value, Types::Nullable::Float.is(:read_only)
|
45
|
+
|
46
|
+
# Country Country for the document address.
|
47
|
+
attribute :country, Types::CountryCode
|
48
|
+
|
49
|
+
# CostCenter Code of the cost center.
|
50
|
+
attribute :cost_center, Types::Nullable::String
|
51
|
+
|
52
|
+
# Currency Code of the currency.
|
53
|
+
attribute :currency, Types::Currency
|
54
|
+
|
55
|
+
# CurrencyRate Currency rate used for the document
|
56
|
+
attribute :currency_rate, Types::Nullable::Float
|
57
|
+
|
58
|
+
# CurrencyUnit Currency unit used for the document
|
59
|
+
attribute :currency_unit, Types::Nullable::Float
|
60
|
+
|
61
|
+
# CustomerName Name of the customer. 1024 characters
|
62
|
+
attribute :customer_name, Types::Sized::String[1024]
|
63
|
+
|
64
|
+
# CustomerNumber Customer number of the customer. Required
|
65
|
+
attribute :customer_number, Types::Required::String
|
66
|
+
|
67
|
+
# DeliveryAddress1 Document delivery address 1.
|
68
|
+
attribute :delivery_address1, Types::Sized::String[1024]
|
69
|
+
|
70
|
+
# DeliveryAddress2 Document delivery address 2.
|
71
|
+
attribute :delivery_address2, Types::Sized::String[1024]
|
72
|
+
|
73
|
+
# DeliveryCity City for the document delivery address.
|
74
|
+
attribute :delivery_city, Types::Sized::String[1024]
|
75
|
+
|
76
|
+
# DeliveryCountry Country for the document delivery address.
|
77
|
+
attribute :delivery_country, Types::CountryCode
|
78
|
+
|
79
|
+
# DeliveryDate Date of delivery.
|
80
|
+
attribute :delivery_date, Types::Nullable::Date
|
81
|
+
|
82
|
+
# DeliveryName Name of the recipient of the delivery
|
83
|
+
attribute :delivery_name, Types::Sized::String[1024]
|
84
|
+
|
85
|
+
# DeliveryZipCode ZipCode for the document delivery address.
|
86
|
+
attribute :delivery_zip_code, Types::Sized::String[1024]
|
87
|
+
|
88
|
+
# DocumentNumber The document number.
|
89
|
+
attribute :document_number, Types::Nullable::Integer
|
90
|
+
|
91
|
+
# EmailInformation Separete EmailInformation object
|
92
|
+
attribute :email_information, Types::EmailInformation
|
93
|
+
|
94
|
+
# ExternalInvoiceReference1 External document reference 1. 80 characters
|
95
|
+
attribute :external_invoice_reference1, Types::Sized::String[80]
|
96
|
+
|
97
|
+
# ExternalInvoiceReference2 External document reference 2. 80 characters
|
98
|
+
attribute :external_invoice_reference2, Types::Sized::String[80]
|
99
|
+
|
100
|
+
# Freight Freight cost of the document. 12 digits (incl. decimals)
|
101
|
+
attribute :freight, Types::Sized::Float[0.0, 99_999_999_999.9]
|
102
|
+
|
103
|
+
# FreightVAT VAT of the freight cost.
|
104
|
+
attribute :freight_vat, Types::Nullable::Float.is(:read_only)
|
105
|
+
|
106
|
+
# Gross Gross value of the document
|
107
|
+
attribute :gross, Types::Nullable::Float.is(:read_only)
|
108
|
+
|
109
|
+
# HouseWork If there is any row of the document marked "housework".
|
110
|
+
attribute :housework, Types::Nullable::Boolean.is(:read_only)
|
111
|
+
|
112
|
+
attribute :labels, Types::Strict::Array.member(Label)
|
113
|
+
|
114
|
+
# Net Net amount
|
115
|
+
attribute :net, Types::Nullable::Float.is(:read_only)
|
116
|
+
|
117
|
+
# NotCompleted If the document is set as not completed.
|
118
|
+
attribute :not_completed, Types::Nullable::Boolean
|
119
|
+
|
120
|
+
# OfferReference Reference to the offer, if one exists.
|
121
|
+
attribute :offer_reference, Types::Nullable::Integer.is(:read_only)
|
122
|
+
|
123
|
+
# OrganisationNumber Organisation number of the customer for the
|
124
|
+
# document.
|
125
|
+
attribute :organisation_number, Types::Nullable::String.is(:read_only)
|
126
|
+
|
127
|
+
# OurReference Our reference. 50 characters
|
128
|
+
attribute :our_reference, Types::Sized::String[50]
|
129
|
+
|
130
|
+
# Phone1 Phone number 1 of the customer for the document. 1024 characters
|
131
|
+
attribute :phone1, Types::Sized::String[1024]
|
132
|
+
|
133
|
+
# Phone2 Phone number 2 of the customer for the document. 1024 characters
|
134
|
+
attribute :phone2, Types::Sized::String[1024]
|
135
|
+
|
136
|
+
# PriceList Code of the price list.
|
137
|
+
attribute :price_list, Types::Nullable::String
|
138
|
+
|
139
|
+
# PrintTemplate Print template of the document.
|
140
|
+
attribute :print_template, Types::Nullable::String
|
141
|
+
|
142
|
+
# Project Code of the project.
|
143
|
+
attribute :project, Types::Nullable::String
|
144
|
+
|
145
|
+
# Remarks Remarks of the document. 1024 characters
|
146
|
+
attribute :remarks, Types::Sized::String[1024]
|
147
|
+
|
148
|
+
# RoundOff Round off amount for the document.
|
149
|
+
attribute :round_off, Types::Nullable::Float.is(:read_only)
|
150
|
+
|
151
|
+
# Sent If the document is printed or sent in any way.
|
152
|
+
attribute :sent, Types::Nullable::Boolean.is(:read_only)
|
153
|
+
|
154
|
+
# TaxReduction The amount of tax reduction.
|
155
|
+
attribute :tax_reduction, Types::Nullable::Integer.is(:read_only)
|
156
|
+
|
157
|
+
# TermsOfDelivery Code of the terms of delivery.
|
158
|
+
attribute :terms_of_delivery, Types::Nullable::String
|
159
|
+
|
160
|
+
# TermsOfPayment Code of the terms of payment.
|
161
|
+
attribute :terms_of_payment, Types::Nullable::String
|
162
|
+
|
163
|
+
# Total The total amount of the document.
|
164
|
+
attribute :total, Types::Nullable::Float.is(:read_only)
|
165
|
+
|
166
|
+
# TotalVAT The total VAT amount of the document.
|
167
|
+
attribute :total_vat, Types::Nullable::Float.is(:read_only)
|
168
|
+
|
169
|
+
# VATIncluded If the price of the document is including VAT.
|
170
|
+
attribute :vat_included, Types::Nullable::Boolean
|
171
|
+
|
172
|
+
# WayOfDelivery Code of the way of delivery.
|
173
|
+
attribute :way_of_delivery, Types::Nullable::String
|
174
|
+
|
175
|
+
# YourOrderNumber Your order number. 30 characters
|
176
|
+
attribute :your_order_number, Types::Sized::String[30]
|
177
|
+
|
178
|
+
# YourReference Your reference. 50 characters
|
179
|
+
attribute :your_reference, Types::Sized::String[50]
|
180
|
+
|
181
|
+
# ZipCode Zip code of the document. 1024 characters
|
182
|
+
attribute :zip_code, Types::Sized::String[1024]
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|