fortnox-api 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -0
  3. data/.env.template +7 -0
  4. data/.env.test +11 -3
  5. data/.gitignore +7 -1
  6. data/.rubocop.yml +18 -2
  7. data/.tool-versions +1 -0
  8. data/.travis.yml +15 -12
  9. data/CHANGELOG.md +58 -3
  10. data/CONTRIBUTE.md +21 -9
  11. data/DEVELOPER_README.md +72 -0
  12. data/Guardfile +13 -4
  13. data/README.md +226 -64
  14. data/Rakefile +128 -0
  15. data/bin/get_tokens +79 -0
  16. data/bin/renew_tokens +28 -0
  17. data/fortnox-api.gemspec +31 -25
  18. data/lib/fortnox/api/mappers/article.rb +1 -1
  19. data/lib/fortnox/api/mappers/base/from_json.rb +5 -4
  20. data/lib/fortnox/api/mappers/base/to_json.rb +4 -5
  21. data/lib/fortnox/api/mappers/base.rb +3 -3
  22. data/lib/fortnox/api/mappers/customer.rb +1 -1
  23. data/lib/fortnox/api/mappers/default_delivery_types.rb +1 -1
  24. data/lib/fortnox/api/mappers/default_templates.rb +1 -1
  25. data/lib/fortnox/api/mappers/edi_information.rb +1 -1
  26. data/lib/fortnox/api/mappers/email_information.rb +1 -1
  27. data/lib/fortnox/api/mappers/invoice.rb +4 -4
  28. data/lib/fortnox/api/mappers/invoice_row.rb +1 -1
  29. data/lib/fortnox/api/mappers/order.rb +4 -4
  30. data/lib/fortnox/api/mappers/order_row.rb +1 -1
  31. data/lib/fortnox/api/mappers/project.rb +1 -1
  32. data/lib/fortnox/api/mappers/terms_of_payment.rb +1 -1
  33. data/lib/fortnox/api/mappers/unit.rb +1 -1
  34. data/lib/fortnox/api/mappers/value/country_string.rb +1 -1
  35. data/lib/fortnox/api/mappers.rb +18 -18
  36. data/lib/fortnox/api/models/article.rb +2 -2
  37. data/lib/fortnox/api/models/base.rb +23 -21
  38. data/lib/fortnox/api/models/customer.rb +57 -57
  39. data/lib/fortnox/api/models/document.rb +2 -2
  40. data/lib/fortnox/api/models/invoice.rb +2 -2
  41. data/lib/fortnox/api/models/label.rb +3 -3
  42. data/lib/fortnox/api/models/order.rb +2 -2
  43. data/lib/fortnox/api/models/project.rb +2 -2
  44. data/lib/fortnox/api/models/terms_of_payment.rb +2 -2
  45. data/lib/fortnox/api/models/unit.rb +2 -2
  46. data/lib/fortnox/api/models.rb +7 -7
  47. data/lib/fortnox/api/repositories/article.rb +3 -3
  48. data/lib/fortnox/api/repositories/authentication.rb +61 -0
  49. data/lib/fortnox/api/repositories/base/savers.rb +3 -1
  50. data/lib/fortnox/api/repositories/base.rb +25 -38
  51. data/lib/fortnox/api/repositories/customer.rb +3 -3
  52. data/lib/fortnox/api/repositories/invoice.rb +3 -3
  53. data/lib/fortnox/api/repositories/order.rb +3 -3
  54. data/lib/fortnox/api/repositories/project.rb +3 -3
  55. data/lib/fortnox/api/repositories/terms_of_payment.rb +3 -3
  56. data/lib/fortnox/api/repositories/unit.rb +3 -3
  57. data/lib/fortnox/api/repositories.rb +8 -7
  58. data/lib/fortnox/api/request_handling.rb +30 -18
  59. data/lib/fortnox/api/types/default_delivery_types.rb +0 -2
  60. data/lib/fortnox/api/types/default_templates.rb +0 -2
  61. data/lib/fortnox/api/types/document_row.rb +3 -3
  62. data/lib/fortnox/api/types/edi_information.rb +0 -2
  63. data/lib/fortnox/api/types/email_information.rb +0 -2
  64. data/lib/fortnox/api/types/enums.rb +27 -11
  65. data/lib/fortnox/api/types/invoice_row.rb +1 -1
  66. data/lib/fortnox/api/types/model.rb +5 -9
  67. data/lib/fortnox/api/types/nullable.rb +13 -9
  68. data/lib/fortnox/api/types/order_row.rb +1 -1
  69. data/lib/fortnox/api/types/required.rb +3 -3
  70. data/lib/fortnox/api/types/sized.rb +4 -4
  71. data/lib/fortnox/api/types.rb +31 -23
  72. data/lib/fortnox/api/version.rb +1 -1
  73. data/lib/fortnox/api.rb +21 -39
  74. data/spec/fortnox/api/mappers/base/canonical_name_sym_spec.rb +13 -11
  75. data/spec/fortnox/api/mappers/base/from_json_spec.rb +10 -12
  76. data/spec/fortnox/api/mappers/base/to_json_spec.rb +48 -57
  77. data/spec/fortnox/api/mappers/base_spec.rb +4 -7
  78. data/spec/fortnox/api/mappers/contexts/json_conversion.rb +38 -33
  79. data/spec/fortnox/api/mappers/default_delivery_types_spec.rb +1 -1
  80. data/spec/fortnox/api/mappers/examples/mapper.rb +1 -1
  81. data/spec/fortnox/api/mappers/unit_spec.rb +3 -4
  82. data/spec/fortnox/api/models/base_spec.rb +33 -22
  83. data/spec/fortnox/api/models/unit_spec.rb +5 -3
  84. data/spec/fortnox/api/repositories/article_spec.rb +14 -9
  85. data/spec/fortnox/api/repositories/authentication_spec.rb +103 -0
  86. data/spec/fortnox/api/repositories/base_spec.rb +105 -326
  87. data/spec/fortnox/api/repositories/customer_spec.rb +37 -7
  88. data/spec/fortnox/api/repositories/examples/all.rb +0 -1
  89. data/spec/fortnox/api/repositories/examples/find.rb +5 -8
  90. data/spec/fortnox/api/repositories/examples/only.rb +4 -13
  91. data/spec/fortnox/api/repositories/examples/save.rb +32 -18
  92. data/spec/fortnox/api/repositories/examples/save_with_nested_model.rb +0 -5
  93. data/spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb +1 -4
  94. data/spec/fortnox/api/repositories/examples/search.rb +4 -7
  95. data/spec/fortnox/api/repositories/invoice_spec.rb +64 -21
  96. data/spec/fortnox/api/repositories/order_spec.rb +11 -9
  97. data/spec/fortnox/api/repositories/project_spec.rb +7 -6
  98. data/spec/fortnox/api/repositories/terms_of_payment_spec.rb +9 -7
  99. data/spec/fortnox/api/repositories/unit_spec.rb +13 -11
  100. data/spec/fortnox/api/types/country_spec.rb +1 -1
  101. data/spec/fortnox/api/types/email_spec.rb +2 -2
  102. data/spec/fortnox/api/types/examples/document_row.rb +3 -3
  103. data/spec/fortnox/api/types/examples/enum.rb +4 -4
  104. data/spec/fortnox/api/types/examples/types.rb +1 -3
  105. data/spec/fortnox/api/types/housework_types_spec.rb +54 -90
  106. data/spec/fortnox/api/types/model_spec.rb +13 -23
  107. data/spec/fortnox/api/types/nullable_spec.rb +30 -10
  108. data/spec/fortnox/api/types/order_row_spec.rb +2 -2
  109. data/spec/fortnox/api/types/required_spec.rb +7 -15
  110. data/spec/fortnox/api/types/sales_account_spec.rb +57 -0
  111. data/spec/fortnox/api_spec.rb +19 -124
  112. data/spec/spec_helper.rb +0 -14
  113. data/spec/support/helpers/configuration_helper.rb +30 -3
  114. data/spec/support/helpers.rb +1 -1
  115. data/spec/support/matchers/type/attribute_matcher.rb +2 -2
  116. data/spec/support/matchers/type/enum_matcher.rb +1 -1
  117. data/spec/support/matchers/type/have_account_number_matcher.rb +1 -1
  118. data/spec/support/matchers/type/have_email_matcher.rb +1 -1
  119. data/spec/support/matchers/type/have_nullable_date_matcher.rb +7 -5
  120. data/spec/support/matchers/type/have_nullable_matcher.rb +1 -1
  121. data/spec/support/matchers/type/have_nullable_string_matcher.rb +5 -5
  122. data/spec/support/matchers/type/require_attribute_matcher.rb +5 -5
  123. data/spec/support/matchers/type/type_matcher.rb +1 -1
  124. data/spec/support/vcr_setup.rb +16 -0
  125. data/spec/vcr_cassettes/articles/all.yml +32 -49
  126. data/spec/vcr_cassettes/articles/find_by_hash_failure.yml +27 -23
  127. data/spec/vcr_cassettes/articles/find_failure.yml +27 -23
  128. data/spec/vcr_cassettes/articles/find_id_1.yml +29 -24
  129. data/spec/vcr_cassettes/articles/find_new.yml +30 -26
  130. data/spec/vcr_cassettes/articles/multi_param_find_by_hash.yml +29 -25
  131. data/spec/vcr_cassettes/articles/save_new.yml +29 -25
  132. data/spec/vcr_cassettes/articles/save_old.yml +30 -26
  133. data/spec/vcr_cassettes/articles/save_with_specially_named_attribute.yml +29 -25
  134. data/spec/vcr_cassettes/articles/search_by_name.yml +32 -25
  135. data/spec/vcr_cassettes/articles/search_miss.yml +27 -23
  136. data/spec/vcr_cassettes/articles/search_with_special_char.yml +27 -23
  137. data/spec/vcr_cassettes/articles/single_param_find_by_hash.yml +29 -36
  138. data/spec/vcr_cassettes/authentication/expired_token.yml +54 -0
  139. data/spec/vcr_cassettes/authentication/invalid_authorization.yml +57 -0
  140. data/spec/vcr_cassettes/authentication/invalid_refresh_token.yml +58 -0
  141. data/spec/vcr_cassettes/authentication/valid_request.yml +63 -0
  142. data/spec/vcr_cassettes/customers/all.yml +35 -136
  143. data/spec/vcr_cassettes/customers/find_by_hash_failure.yml +27 -23
  144. data/spec/vcr_cassettes/customers/find_failure.yml +27 -23
  145. data/spec/vcr_cassettes/customers/find_id_1.yml +30 -25
  146. data/spec/vcr_cassettes/customers/find_new.yml +29 -25
  147. data/spec/vcr_cassettes/customers/find_with_sales_account.yml +63 -0
  148. data/spec/vcr_cassettes/customers/multi_param_find_by_hash.yml +29 -25
  149. data/spec/vcr_cassettes/customers/save_new.yml +28 -24
  150. data/spec/vcr_cassettes/customers/save_new_with_country_code_SE.yml +28 -24
  151. data/spec/vcr_cassettes/customers/save_new_with_sales_account.yml +63 -0
  152. data/spec/vcr_cassettes/customers/save_old.yml +29 -25
  153. data/spec/vcr_cassettes/customers/save_with_specially_named_attribute.yml +28 -24
  154. data/spec/vcr_cassettes/customers/search_by_name.yml +29 -53
  155. data/spec/vcr_cassettes/customers/search_miss.yml +27 -23
  156. data/spec/vcr_cassettes/customers/search_with_special_char.yml +27 -23
  157. data/spec/vcr_cassettes/customers/single_param_find_by_hash.yml +30 -26
  158. data/spec/vcr_cassettes/invoices/all.yml +62 -121
  159. data/spec/vcr_cassettes/invoices/filter_hit.yml +30 -28
  160. data/spec/vcr_cassettes/invoices/filter_invalid.yml +27 -23
  161. data/spec/vcr_cassettes/invoices/find_by_hash_failure.yml +27 -23
  162. data/spec/vcr_cassettes/invoices/find_failure.yml +27 -23
  163. data/spec/vcr_cassettes/invoices/find_id_1.yml +31 -26
  164. data/spec/vcr_cassettes/invoices/find_new.yml +32 -28
  165. data/spec/vcr_cassettes/invoices/multi_param_find_by_hash.yml +29 -25
  166. data/spec/vcr_cassettes/invoices/row_description_limit.yml +65 -0
  167. data/spec/vcr_cassettes/invoices/save_new.yml +31 -27
  168. data/spec/vcr_cassettes/invoices/save_new_with_comments.yml +31 -27
  169. data/spec/vcr_cassettes/invoices/save_new_with_country.yml +31 -26
  170. data/spec/vcr_cassettes/invoices/save_new_with_country_GB.yml +32 -27
  171. data/spec/vcr_cassettes/invoices/save_new_with_country_Norge.yml +31 -26
  172. data/spec/vcr_cassettes/invoices/save_new_with_country_Norway.yml +31 -26
  173. data/spec/vcr_cassettes/invoices/save_new_with_country_Sverige.yml +31 -26
  174. data/spec/vcr_cassettes/invoices/save_new_with_country_VA.yml +32 -27
  175. data/spec/vcr_cassettes/invoices/save_new_with_country_VI.yml +32 -27
  176. data/spec/vcr_cassettes/invoices/save_new_with_country_empty_string.yml +31 -26
  177. data/spec/vcr_cassettes/invoices/save_new_with_country_nil.yml +31 -26
  178. data/spec/vcr_cassettes/invoices/save_new_with_unsaved_parent.yml +65 -0
  179. data/spec/vcr_cassettes/invoices/save_old.yml +32 -28
  180. data/spec/vcr_cassettes/invoices/save_old_with_empty_comments.yml +32 -28
  181. data/spec/vcr_cassettes/invoices/save_old_with_empty_country.yml +32 -27
  182. data/spec/vcr_cassettes/invoices/save_old_with_nil_comments.yml +32 -28
  183. data/spec/vcr_cassettes/invoices/save_old_with_nil_country.yml +32 -27
  184. data/spec/vcr_cassettes/invoices/save_with_nested_model.yml +32 -27
  185. data/spec/vcr_cassettes/invoices/save_with_specially_named_attribute.yml +31 -26
  186. data/spec/vcr_cassettes/invoices/search_by_name.yml +29 -31
  187. data/spec/vcr_cassettes/invoices/search_miss.yml +27 -23
  188. data/spec/vcr_cassettes/invoices/search_with_special_char.yml +27 -23
  189. data/spec/vcr_cassettes/invoices/single_param_find_by_hash.yml +30 -26
  190. data/spec/vcr_cassettes/orders/all.yml +35 -123
  191. data/spec/vcr_cassettes/orders/filter_hit.yml +30 -30
  192. data/spec/vcr_cassettes/orders/filter_invalid.yml +27 -23
  193. data/spec/vcr_cassettes/orders/find_by_hash_failure.yml +27 -23
  194. data/spec/vcr_cassettes/orders/find_failure.yml +27 -23
  195. data/spec/vcr_cassettes/orders/find_id_1.yml +33 -27
  196. data/spec/vcr_cassettes/orders/find_new.yml +32 -28
  197. data/spec/vcr_cassettes/orders/housework_invalid_tax_reduction_type.yml +28 -24
  198. data/spec/vcr_cassettes/orders/housework_othercoses_invalid.yml +28 -24
  199. data/spec/vcr_cassettes/orders/housework_type_babysitting.yml +32 -27
  200. data/spec/vcr_cassettes/orders/housework_type_cleaning.yml +32 -27
  201. data/spec/vcr_cassettes/orders/housework_type_construction.yml +32 -27
  202. data/spec/vcr_cassettes/orders/housework_type_cooking.yml +28 -24
  203. data/spec/vcr_cassettes/orders/housework_type_electricity.yml +32 -27
  204. data/spec/vcr_cassettes/orders/housework_type_gardening.yml +32 -27
  205. data/spec/vcr_cassettes/orders/housework_type_glassmetalwork.yml +32 -27
  206. data/spec/vcr_cassettes/orders/housework_type_grounddrainagework.yml +32 -27
  207. data/spec/vcr_cassettes/orders/housework_type_hvac.yml +32 -27
  208. data/spec/vcr_cassettes/orders/housework_type_itservices.yml +32 -27
  209. data/spec/vcr_cassettes/orders/housework_type_majorappliancerepair.yml +32 -27
  210. data/spec/vcr_cassettes/orders/housework_type_masonry.yml +32 -27
  211. data/spec/vcr_cassettes/orders/housework_type_movingservices.yml +32 -27
  212. data/spec/vcr_cassettes/orders/housework_type_othercare.yml +32 -27
  213. data/spec/vcr_cassettes/orders/housework_type_othercosts.yml +32 -27
  214. data/spec/vcr_cassettes/orders/housework_type_paintingwallpapering.yml +32 -27
  215. data/spec/vcr_cassettes/orders/housework_type_snowplowing.yml +32 -27
  216. data/spec/vcr_cassettes/orders/housework_type_textileclothing.yml +32 -27
  217. data/spec/vcr_cassettes/orders/housework_type_tutoring.yml +28 -24
  218. data/spec/vcr_cassettes/orders/multi_param_find_by_hash.yml +29 -25
  219. data/spec/vcr_cassettes/orders/save_new.yml +32 -28
  220. data/spec/vcr_cassettes/orders/save_old.yml +32 -28
  221. data/spec/vcr_cassettes/orders/save_with_nested_model.yml +32 -27
  222. data/spec/vcr_cassettes/orders/search_by_name.yml +29 -27
  223. data/spec/vcr_cassettes/orders/search_miss.yml +27 -23
  224. data/spec/vcr_cassettes/orders/search_with_special_char.yml +27 -23
  225. data/spec/vcr_cassettes/orders/single_param_find_by_hash.yml +30 -26
  226. data/spec/vcr_cassettes/projects/all.yml +30 -43
  227. data/spec/vcr_cassettes/projects/find_by_hash_failure.yml +27 -23
  228. data/spec/vcr_cassettes/projects/find_failure.yml +27 -23
  229. data/spec/vcr_cassettes/projects/find_id_1.yml +29 -25
  230. data/spec/vcr_cassettes/projects/find_new.yml +30 -26
  231. data/spec/vcr_cassettes/projects/multi_param_find_by_hash.yml +31 -26
  232. data/spec/vcr_cassettes/projects/save_new.yml +29 -25
  233. data/spec/vcr_cassettes/projects/save_old.yml +30 -26
  234. data/spec/vcr_cassettes/projects/single_param_find_by_hash.yml +29 -25
  235. data/spec/vcr_cassettes/termsofpayments/all.yml +32 -32
  236. data/spec/vcr_cassettes/termsofpayments/find_failure.yml +27 -23
  237. data/spec/vcr_cassettes/termsofpayments/find_id_1.yml +29 -26
  238. data/spec/vcr_cassettes/termsofpayments/find_new.yml +29 -25
  239. data/spec/vcr_cassettes/termsofpayments/save_new.yml +29 -25
  240. data/spec/vcr_cassettes/termsofpayments/save_old.yml +29 -25
  241. data/spec/vcr_cassettes/units/all.yml +29 -32
  242. data/spec/vcr_cassettes/units/find_failure.yml +27 -23
  243. data/spec/vcr_cassettes/units/find_id_1.yml +29 -25
  244. data/spec/vcr_cassettes/units/find_new.yml +29 -25
  245. data/spec/vcr_cassettes/units/save_new.yml +29 -25
  246. data/spec/vcr_cassettes/units/save_old.yml +29 -25
  247. data/spec/vcr_cassettes/units/save_with_specially_named_attribute.yml +29 -25
  248. metadata +130 -261
  249. data/lib/fortnox/api/circular_queue.rb +0 -39
  250. data/spec/fortnox/api/circular_queue_spec.rb +0 -52
  251. data/spec/support/helpers/dummy_class_helper.rb +0 -38
  252. data/spec/support/helpers/when_performing_helper.rb +0 -7
  253. data/spec/vcr_cassettes/invoices/save_new_with_country_KR.yml +0 -61
  254. data/spec/vcr_cassettes/orders/housework_without_tax_reduction_type.yml +0 -57
  255. data/temp.txt +0 -1
data/spec/spec_helper.rb CHANGED
@@ -20,26 +20,12 @@ RSpec.configure do |config|
20
20
  config.extend Helpers # Allow access to helpers in describe and context blocks
21
21
  config.include Helpers # Allow access to helpers in it and let blocks
22
22
 
23
- config.include Helpers::Repositories, integration: true
24
23
  config.include Matchers::Type, type: :type
25
24
 
26
25
  config.order = 'random'
27
26
 
28
27
  WebMock.disable_net_connect!(allow: 'codeclimate.com')
29
28
 
30
- config.before do
31
- module Test
32
- def self.remove_constants
33
- constants.each { |const| remove_const(const) }
34
- self
35
- end
36
- end
37
- end
38
-
39
- config.after do
40
- Object.send(:remove_const, Test.remove_constants.name)
41
- end
42
-
43
29
  # Reset configuration after each test run
44
30
  config.after do
45
31
  Fortnox::API::DEFAULT_CONFIGURATION.each do |key, value|
@@ -1,12 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'dotenv'
4
+ require 'jwt'
5
+
6
+ DOTENV_FILE_NAME = '.env.test'
7
+ Dotenv.load(DOTENV_FILE_NAME)
8
+
9
+ DEBUG = ENV.fetch('DEBUG', false) == true
10
+
3
11
  module Helpers
4
12
  module Configuration
5
- def set_api_test_configuration
13
+ def set_api_test_configuration # rubocop:disable Metrics/MethodLength
6
14
  Fortnox::API.configure do |config|
7
- config.client_secret = '9aBA8ZgsvR'
8
- config.access_tokens = ['ccaef817-d5d8-4b1c-a316-54f3e55c5c54']
15
+ config.debugging = DEBUG
16
+
17
+ if DEBUG
18
+ config.logger = lambda {
19
+ logger = Logger.new($stdout)
20
+ logger.level = Logger::DEBUG
21
+ return logger
22
+ }.call
23
+ end
9
24
  end
25
+
26
+ Fortnox::API.access_token = ENV.fetch('FORTNOX_API_ACCESS_TOKEN')
27
+ end
28
+
29
+ def add_to_registry(symbol, klass)
30
+ unless Fortnox::API::Registry.key? symbol
31
+ # Only register the key once...
32
+ Fortnox::API::Registry.register(symbol) { klass }
33
+ end
34
+
35
+ # ... but stub the value each test run
36
+ Fortnox::API::Registry.stub(symbol, klass)
10
37
  end
11
38
  end
12
39
  end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir[File.expand_path('spec/support/helpers/*.rb')].each { |file| require file }
3
+ Dir[File.expand_path('spec/support/helpers/*.rb')].sort.each { |file| require file }
@@ -19,7 +19,7 @@ module Matchers
19
19
  end
20
20
 
21
21
  def failure_message
22
- "Expected class to have attribute #{@attribute.inspect} defined as #{@attribute_type}, "\
22
+ "Expected class to have attribute #{@attribute.inspect} defined as #{@attribute_type}, " \
23
23
  "but got following errors:
24
24
  #{@errors}"
25
25
  end
@@ -29,7 +29,7 @@ module Matchers
29
29
  def expect_error(msg)
30
30
  yield
31
31
 
32
- @errors << msg
32
+ @errors = @errors += msg
33
33
  false # Fail test since expected error not thrown
34
34
  rescue Dry::Struct::Error
35
35
  # TODO: check if error message is correct
@@ -15,7 +15,7 @@ module Matchers
15
15
  private
16
16
 
17
17
  def expected_type?
18
- @actual_type = @klass.schema[@attribute]
18
+ @actual_type = @klass.schema.keys.find { |x| x.name == @attribute }&.type
19
19
  @actual_type == @enum_type
20
20
  end
21
21
  end
@@ -15,7 +15,7 @@ module Matchers
15
15
  private
16
16
 
17
17
  def expected_type?
18
- @actual_type = @klass.schema[@attribute]
18
+ @actual_type = @klass.schema.keys.find { |x| x.name == @attribute }&.type
19
19
  @actual_type == Fortnox::API::Types::AccountNumber
20
20
  end
21
21
  end
@@ -16,7 +16,7 @@ module Matchers
16
16
  private
17
17
 
18
18
  def expected_type?
19
- @actual_type = @klass.schema[@attribute]
19
+ @actual_type = @klass.schema.keys.find { |x| x.name == @attribute }&.type
20
20
  @actual_type == Fortnox::API::Types::Email
21
21
  end
22
22
  end
@@ -11,9 +11,11 @@ module Matchers
11
11
  @attribute = attribute
12
12
  @valid_value = valid_value
13
13
  @invalid_value = invalid_value
14
- @expected_error = ArgumentError
14
+ @expected_error = Fortnox::API::AttributeError
15
15
  @expected_error_message = 'invalid date'
16
16
  @failure_description = ''
17
+
18
+ super(attribute, valid_value, invalid_value, nil)
17
19
  end
18
20
 
19
21
  def matches?(klass)
@@ -46,11 +48,11 @@ module Matchers
46
48
 
47
49
  @failure_description << " (Expected #{@expected_error}, but got none)"
48
50
  false
49
- rescue @expected_error => error
50
- return true if error.message == @expected_error_message
51
+ rescue @expected_error => exception
52
+ return true if exception.message == @expected_error_message
51
53
 
52
- fail_message = "Expected error message to include #{expected_message.inspect}, "\
53
- "but was #{error.message.inspect}"
54
+ fail_message = "Expected error message to include #{@expected_error_message.inspect}, " \
55
+ "but was #{exception.message.inspect}"
54
56
  raise(fail_message)
55
57
  end
56
58
  end
@@ -45,7 +45,7 @@ module Matchers
45
45
  value = model.send(@attribute)
46
46
  return true if value == @default_value
47
47
 
48
- @failure_description << " (Expected #{@invalid_value.inspect} to default to "\
48
+ @failure_description << " (Expected #{@invalid_value.inspect} to default to " \
49
49
  "#{@default_value.inspect}), but got #{value.inspect}"
50
50
  false
51
51
  end
@@ -33,13 +33,13 @@ module Matchers
33
33
  def rejects_non_string?
34
34
  non_string = 10.0
35
35
  @klass.new(@valid_hash.merge(@attribute => non_string))
36
- rescue Fortnox::API::InvalidAttributeValueError => error
37
- expected_message = "#{non_string.inspect} (#{non_string.class}) "\
36
+ rescue Fortnox::API::AttributeError => exception
37
+ expected_message = "#{non_string.inspect} (#{non_string.class}) " \
38
38
  "has invalid type for #{@attribute.inspect}"
39
- return true if error.message.include?(expected_message)
39
+ return true if exception.message.include?(expected_message)
40
40
 
41
- fail_message = "Expected error message to include #{expected_message.inspect}, "\
42
- "but was #{error.message.inspect}"
41
+ fail_message = "Expected error message to include #{expected_message.inspect}, " \
42
+ "but was #{exception.message.inspect}"
43
43
  raise(fail_message)
44
44
  end
45
45
  end
@@ -43,10 +43,10 @@ module Matchers
43
43
 
44
44
  def includes_error_message
45
45
  @klass.new(@invalid_hash)
46
- rescue EXCEPTION => error
47
- return true if error.message.include? expected_error_message
46
+ rescue EXCEPTION => exception
47
+ return true if exception.message.include? expected_error_message
48
48
 
49
- @wrong_error_message = error.message
49
+ @wrong_error_message = exception.message
50
50
  false
51
51
  end
52
52
 
@@ -55,12 +55,12 @@ module Matchers
55
55
  end
56
56
 
57
57
  def no_exception_failure_message
58
- "Expected class to raise #{EXCEPTION} "\
58
+ "Expected class to raise #{EXCEPTION} " \
59
59
  "when attribute #{@attribute.inspect} is missing."
60
60
  end
61
61
 
62
62
  def wrong_error_message
63
- "Expected exception to equal #{expected_error_message.inspect}. "\
63
+ "Expected exception to equal #{expected_error_message.inspect}. " \
64
64
  "Message was #{@wrong_error_message.inspect}."
65
65
  end
66
66
  end
@@ -21,7 +21,7 @@ module Matchers
21
21
  def correct_type?
22
22
  return true if expected_type?
23
23
 
24
- @errors << "Attribute #{@attribute.inspect} was expected to be of type #{@attribute_type}, "\
24
+ @errors << "Attribute #{@attribute.inspect} was expected to be of type #{@attribute_type}, " \
25
25
  "but was #{@actual_type}"
26
26
  false
27
27
  end
@@ -5,4 +5,20 @@ require 'vcr'
5
5
  VCR.configure do |c|
6
6
  c.cassette_library_dir = 'spec/vcr_cassettes'
7
7
  c.hook_into :webmock
8
+ c.filter_sensitive_data('<AUTHORIZATION>') do |interaction|
9
+ interaction.request.headers['Authorization']&.first
10
+ end
11
+ c.filter_sensitive_data('<REFRESH_TOKEN>') do |interaction|
12
+ interaction.request.body.split('&refresh_token=').last
13
+ end
14
+ c.filter_sensitive_data('<ACCESS_TOKEN>') do |interaction|
15
+ body = interaction.response.body
16
+ access_token = /"access_token":"[^"]*"/.match(body)
17
+ access_token ? access_token.to_s.split('"access_token":"').last.chop : ''
18
+ end
19
+ c.filter_sensitive_data('<REFRESH_TOKEN>') do |interaction|
20
+ body = interaction.response.body
21
+ refresh_token = /"refresh_token":"[^"]*"/.match(body)
22
+ refresh_token ? refresh_token.to_s.split('"refresh_token":"').last.chop : ''
23
+ end
8
24
  end
@@ -11,10 +11,8 @@ http_interactions:
11
11
  - application/json
12
12
  Accept:
13
13
  - application/json
14
- Client-Secret:
15
- - 9aBA8ZgsvR
16
- Access-Token:
17
- - ccaef817-d5d8-4b1c-a316-54f3e55c5c54
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
18
16
  Accept-Encoding:
19
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
18
  User-Agent:
@@ -24,61 +22,46 @@ http_interactions:
24
22
  code: 200
25
23
  message: OK
26
24
  headers:
27
- Server:
28
- - nginx
29
- Date:
30
- - Mon, 21 Dec 2020 20:40:04 GMT
25
+ Content-Length:
26
+ - '2040'
31
27
  Content-Type:
32
28
  - application/json
33
- Connection:
34
- - close
29
+ Date:
30
+ - Mon, 30 Jan 2023 10:35:04 GMT
35
31
  Vary:
36
32
  - Accept-Encoding
33
+ X-Build:
34
+ - 16d854443d
35
+ X-Frame-Options:
36
+ - sameorigin
37
37
  X-Rack-Responsetime:
38
- - '30'
38
+ - '99'
39
39
  X-Uid:
40
- - f81e8818
41
- X-Build:
42
- - d59e2acefa
43
- Strict-Transport-Security:
44
- - max-age=31536000; includeSubdomains
45
- X-Xss-Protection:
46
- - 1; mode=block
40
+ - 97b8da1b
41
+ Server:
42
+ - Fortnox
47
43
  X-Content-Type-Options:
48
44
  - nosniff
49
- X-Frame-Options:
50
- - sameorigin
45
+ X-Xss-Protection:
46
+ - '0'
51
47
  Referrer-Policy:
52
48
  - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com api.cling.se wss://api.cling.se ''unsafe-inline'' ''unsafe-eval''
55
+ blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
53
58
  body:
54
59
  encoding: ASCII-8BIT
55
- string: '{"MetaInformation":{"@TotalResources":29,"@TotalPages":1,"@CurrentPage":1},"Articles":[{"@url":"https:\/\/api.fortnox.se\/3\/articles\/0000","ArticleNumber":"0000","Description":"Testartikel","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/0001","ArticleNumber":"0001","Description":"Cykelpump","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":"100","QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/1","ArticleNumber":"1","Description":"Testartikel","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":"100","QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/2","ArticleNumber":"2","Description":"A
56
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/3","ArticleNumber":"3","Description":"Test
57
- article","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/4","ArticleNumber":"4","Description":"Test
58
- article","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/5","ArticleNumber":"5","Description":"Test
59
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/6","ArticleNumber":"6","Description":"A
60
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/7","ArticleNumber":"7","Description":"Test
61
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/8","ArticleNumber":"8","Description":"A
62
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/9","ArticleNumber":"9","Description":"A
63
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/10","ArticleNumber":"10","Description":"Abc
64
- 123","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/11","ArticleNumber":"11","Description":"A
65
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/12","ArticleNumber":"12","Description":"Test
66
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/13","ArticleNumber":"13","Description":"Test
67
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/14","ArticleNumber":"14","Description":"A
68
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/15","ArticleNumber":"15","Description":"A
69
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/16","ArticleNumber":"16","Description":"Test
70
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/17","ArticleNumber":"17","Description":"A
71
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/18","ArticleNumber":"18","Description":"Updated
72
- description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/19","ArticleNumber":"19","Description":"Updated
73
- description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/20","ArticleNumber":"20","Description":"Test
74
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/21","ArticleNumber":"21","Description":"Updated
75
- description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/22","ArticleNumber":"22","Description":"Test
76
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/23","ArticleNumber":"23","Description":"Updated
77
- description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/24","ArticleNumber":"24","Description":"Test
78
- article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/25","ArticleNumber":"25","Description":"A
79
- value","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/26","ArticleNumber":"26","Description":"Updated
80
- description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/27","ArticleNumber":"27","Description":"Test
60
+ string: '{"MetaInformation":{"@TotalResources":6,"@TotalPages":1,"@CurrentPage":1},"Articles":[{"@url":"https:\/\/api.fortnox.se\/3\/articles\/1","ArticleNumber":"1","Description":"Test
61
+ article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/2","ArticleNumber":"2","Description":"Updated
62
+ description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/3","ArticleNumber":"3","Description":"Test
63
+ article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/101","ArticleNumber":"101","Description":"Hammer","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":"","StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/102","ArticleNumber":"102","Description":"Updated
64
+ description","DisposableQuantity":"0","EAN":"","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":null,"VAT":null,"WebshopArticle":false},{"@url":"https:\/\/api.fortnox.se\/3\/articles\/103","ArticleNumber":"103","Description":"Test
81
65
  article","DisposableQuantity":"0","EAN":"5901234123457","Housework":false,"PurchasePrice":"0","SalesPrice":null,"QuantityInStock":"0","ReservedQuantity":"0","StockPlace":null,"StockValue":"0","Unit":"","VAT":null,"WebshopArticle":false}]}'
82
- http_version:
83
- recorded_at: Mon, 21 Dec 2020 20:40:04 GMT
84
- recorded_with: VCR 4.0.0
66
+ recorded_at: Mon, 30 Jan 2023 10:35:04 GMT
67
+ recorded_with: VCR 6.1.0
@@ -11,10 +11,8 @@ http_interactions:
11
11
  - application/json
12
12
  Accept:
13
13
  - application/json
14
- Client-Secret:
15
- - 9aBA8ZgsvR
16
- Access-Token:
17
- - ccaef817-d5d8-4b1c-a316-54f3e55c5c54
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
18
16
  Accept-Encoding:
19
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
18
  User-Agent:
@@ -24,35 +22,41 @@ http_interactions:
24
22
  code: 200
25
23
  message: OK
26
24
  headers:
27
- Server:
28
- - nginx
29
- Date:
30
- - Mon, 21 Dec 2020 20:40:04 GMT
25
+ Content-Length:
26
+ - '88'
31
27
  Content-Type:
32
28
  - application/json
33
- Connection:
34
- - close
29
+ Date:
30
+ - Mon, 30 Jan 2023 10:35:05 GMT
35
31
  Vary:
36
32
  - Accept-Encoding
33
+ X-Build:
34
+ - 16d854443d
35
+ X-Frame-Options:
36
+ - sameorigin
37
37
  X-Rack-Responsetime:
38
- - '26'
38
+ - '73'
39
39
  X-Uid:
40
- - 750fbfe3
41
- X-Build:
42
- - d59e2acefa
43
- Strict-Transport-Security:
44
- - max-age=31536000; includeSubdomains
45
- X-Xss-Protection:
46
- - 1; mode=block
40
+ - 90a7ad19
41
+ Server:
42
+ - Fortnox
47
43
  X-Content-Type-Options:
48
44
  - nosniff
49
- X-Frame-Options:
50
- - sameorigin
45
+ X-Xss-Protection:
46
+ - '0'
51
47
  Referrer-Policy:
52
48
  - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com api.cling.se wss://api.cling.se ''unsafe-inline'' ''unsafe-eval''
55
+ blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
53
58
  body:
54
59
  encoding: ASCII-8BIT
55
60
  string: '{"MetaInformation":{"@TotalResources":0,"@TotalPages":0,"@CurrentPage":1},"Articles":[]}'
56
- http_version:
57
- recorded_at: Mon, 21 Dec 2020 20:40:04 GMT
58
- recorded_with: VCR 4.0.0
61
+ recorded_at: Mon, 30 Jan 2023 10:35:05 GMT
62
+ recorded_with: VCR 6.1.0
@@ -11,10 +11,8 @@ http_interactions:
11
11
  - application/json
12
12
  Accept:
13
13
  - application/json
14
- Client-Secret:
15
- - 9aBA8ZgsvR
16
- Access-Token:
17
- - ccaef817-d5d8-4b1c-a316-54f3e55c5c54
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
18
16
  Accept-Encoding:
19
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
18
  User-Agent:
@@ -24,35 +22,41 @@ http_interactions:
24
22
  code: 404
25
23
  message: Not Found
26
24
  headers:
27
- Server:
28
- - nginx
29
- Date:
30
- - Mon, 21 Dec 2020 20:40:04 GMT
25
+ Content-Length:
26
+ - '84'
31
27
  Content-Type:
32
28
  - application/json
33
- Connection:
34
- - close
29
+ Date:
30
+ - Mon, 30 Jan 2023 10:35:05 GMT
35
31
  Vary:
36
32
  - Accept-Encoding
33
+ X-Build:
34
+ - 16d854443d
35
+ X-Frame-Options:
36
+ - sameorigin
37
37
  X-Rack-Responsetime:
38
- - '24'
38
+ - '85'
39
39
  X-Uid:
40
- - b205151d
41
- X-Build:
42
- - d59e2acefa
43
- Strict-Transport-Security:
44
- - max-age=31536000; includeSubdomains
45
- X-Xss-Protection:
46
- - 1; mode=block
40
+ - 306179db
41
+ Server:
42
+ - Fortnox
47
43
  X-Content-Type-Options:
48
44
  - nosniff
49
- X-Frame-Options:
50
- - sameorigin
45
+ X-Xss-Protection:
46
+ - '0'
51
47
  Referrer-Policy:
52
48
  - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com api.cling.se wss://api.cling.se ''unsafe-inline'' ''unsafe-eval''
55
+ blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
53
58
  body:
54
59
  encoding: ASCII-8BIT
55
60
  string: '{"ErrorInformation":{"Error":1,"Message":"Kan inte hitta artikeln.","Code":2000428}}'
56
- http_version:
57
- recorded_at: Mon, 21 Dec 2020 20:40:04 GMT
58
- recorded_with: VCR 4.0.0
61
+ recorded_at: Mon, 30 Jan 2023 10:35:05 GMT
62
+ recorded_with: VCR 6.1.0
@@ -11,10 +11,8 @@ http_interactions:
11
11
  - application/json
12
12
  Accept:
13
13
  - application/json
14
- Client-Secret:
15
- - 9aBA8ZgsvR
16
- Access-Token:
17
- - ccaef817-d5d8-4b1c-a316-54f3e55c5c54
14
+ Authorization:
15
+ - "<AUTHORIZATION>"
18
16
  Accept-Encoding:
19
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
18
  User-Agent:
@@ -24,35 +22,42 @@ http_interactions:
24
22
  code: 200
25
23
  message: OK
26
24
  headers:
27
- Server:
28
- - nginx
29
- Date:
30
- - Mon, 21 Dec 2020 20:40:04 GMT
25
+ Content-Length:
26
+ - '896'
31
27
  Content-Type:
32
28
  - application/json
33
- Connection:
34
- - close
29
+ Date:
30
+ - Mon, 30 Jan 2023 10:35:04 GMT
35
31
  Vary:
36
32
  - Accept-Encoding
33
+ X-Build:
34
+ - 16d854443d
35
+ X-Frame-Options:
36
+ - sameorigin
37
37
  X-Rack-Responsetime:
38
- - '27'
38
+ - '91'
39
39
  X-Uid:
40
- - b06edbf5
41
- X-Build:
42
- - d59e2acefa
43
- Strict-Transport-Security:
44
- - max-age=31536000; includeSubdomains
45
- X-Xss-Protection:
46
- - 1; mode=block
40
+ - '71616897'
41
+ Server:
42
+ - Fortnox
47
43
  X-Content-Type-Options:
48
44
  - nosniff
49
- X-Frame-Options:
50
- - sameorigin
45
+ X-Xss-Protection:
46
+ - '0'
51
47
  Referrer-Policy:
52
48
  - strict-origin-when-cross-origin
49
+ Content-Security-Policy:
50
+ - 'upgrade-insecure-requests;frame-ancestors https://*.fortnox.se;report-uri
51
+ /api/cspreport;connect-src ''self'' https://a.storyblok.com wss://*.fortnox.se
52
+ *.fortnox.se *.findity.com mybusiness.pwc.se themes.googleusercontent.com
53
+ s3.amazonaws.com/helpjuice-static/ *.helpjuice.com *.vimeo.com fonts.googleapis.com
54
+ fonts.gstatic.com api.cling.se wss://api.cling.se ''unsafe-inline'' ''unsafe-eval''
55
+ blob: data:'
56
+ Strict-Transport-Security:
57
+ - max-age=31536000; includeSubdomains
53
58
  body:
54
59
  encoding: ASCII-8BIT
55
- string: '{"Article":{"@url":"https:\/\/api.fortnox.se\/3\/articles\/1","ArticleNumber":"1","Bulky":false,"ConstructionAccount":1030,"Depth":null,"Description":"Testartikel","DisposableQuantity":-163995.5,"EAN":"","EUAccount":1030,"EUVATAccount":1030,"ExportAccount":1030,"Height":null,"Housework":false,"HouseworkType":null,"Active":true,"Manufacturer":null,"ManufacturerArticleNumber":null,"Note":"","PurchaseAccount":1030,"PurchasePrice":0,"QuantityInStock":0,"ReservedQuantity":163995.5,"SalesAccount":1030,"StockGoods":false,"StockPlace":"","StockValue":0,"StockWarning":null,"SupplierName":null,"SupplierNumber":null,"Type":"STOCK","Unit":null,"VAT":0,"WebshopArticle":false,"Weight":null,"Width":null,"Expired":false,"SalesPrice":100,"CostCalculationMethod":null,"StockAccount":null,"StockChangeAccount":null,"DirectCost":null,"FreightCost":null,"OtherCost":null,"DefaultStockPoint":null,"DefaultStockLocation":null}}'
56
- http_version:
57
- recorded_at: Mon, 21 Dec 2020 20:40:04 GMT
58
- recorded_with: VCR 4.0.0
60
+ string: '{"Article":{"@url":"https:\/\/api.fortnox.se\/3\/articles\/1","ArticleNumber":"1","Bulky":false,"ConstructionAccount":0,"Depth":0,"Description":"Test
61
+ article","DisposableQuantity":0,"EAN":"5901234123457","EUAccount":3108,"EUVATAccount":3106,"ExportAccount":3105,"Height":0,"Housework":false,"HouseworkType":null,"Active":true,"Manufacturer":null,"ManufacturerArticleNumber":"","Note":"","PurchaseAccount":4000,"PurchasePrice":0,"QuantityInStock":0,"ReservedQuantity":0,"SalesAccount":3004,"StockGoods":false,"StockPlace":null,"StockValue":0,"StockWarning":0,"SupplierName":null,"SupplierNumber":null,"Type":"STOCK","Unit":null,"VAT":0,"WebshopArticle":false,"Weight":0,"Width":0,"Expired":false,"SalesPrice":null,"CostCalculationMethod":null,"StockAccount":null,"StockChangeAccount":null,"DirectCost":null,"FreightCost":null,"OtherCost":null,"DefaultStockPoint":null,"DefaultStockLocation":null}}'
62
+ recorded_at: Mon, 30 Jan 2023 10:35:04 GMT
63
+ recorded_with: VCR 6.1.0