nordlet 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nordlet/account/client.rb +252 -19
  3. data/lib/nordlet/account/types/api_keys_list_account_response_rows_item.rb +2 -0
  4. data/lib/nordlet/account/types/export_account_response.rb +8 -0
  5. data/lib/nordlet/account/types/export_account_response_api_keys_item.rb +25 -0
  6. data/lib/nordlet/account/types/export_account_response_auth_events_item.rb +17 -0
  7. data/lib/nordlet/account/types/export_account_response_oauth_grants_item.rb +17 -0
  8. data/lib/nordlet/account/types/export_account_response_referral_points_item.rb +15 -0
  9. data/lib/nordlet/account/types/invites_accept_account_response.rb +2 -0
  10. data/lib/nordlet/account/types/login_link_consume_account_response.rb +2 -0
  11. data/lib/nordlet/account/types/two_factor_disable_account_request.rb +11 -0
  12. data/lib/nordlet/account/types/two_factor_disable_account_response.rb +11 -0
  13. data/lib/nordlet/account/types/two_factor_enable_account_request.rb +11 -0
  14. data/lib/nordlet/account/types/two_factor_enable_account_response.rb +11 -0
  15. data/lib/nordlet/account/types/two_factor_get_account_request.rb +9 -0
  16. data/lib/nordlet/account/types/two_factor_get_account_response.rb +17 -0
  17. data/lib/nordlet/account/types/two_factor_get_account_response_setup.rb +13 -0
  18. data/lib/nordlet/account/types/two_factor_recovery_codes_regenerate_account_request.rb +11 -0
  19. data/lib/nordlet/account/types/two_factor_recovery_codes_regenerate_account_response.rb +11 -0
  20. data/lib/nordlet/account/types/two_factor_setup_account_request.rb +9 -0
  21. data/lib/nordlet/account/types/two_factor_setup_account_response.rb +13 -0
  22. data/lib/nordlet/account/types/two_factor_verify_account_request.rb +11 -0
  23. data/lib/nordlet/account/types/two_factor_verify_account_response.rb +11 -0
  24. data/lib/nordlet/declarations/types/configs_list_declarations_response_rows_item_fields_item_kind.rb +1 -0
  25. data/lib/nordlet/declarations/types/configs_update_declarations_response_fields_item_kind.rb +1 -0
  26. data/lib/nordlet/peppol/client.rb +4 -1
  27. data/lib/nordlet/version.rb +1 -1
  28. data/lib/nordlet/webhooks/client.rb +41 -2
  29. data/lib/nordlet/webhooks/types/subscriptions_rotate_secret_webhooks_request.rb +13 -0
  30. data/lib/nordlet/webhooks/types/subscriptions_rotate_secret_webhooks_response.rb +31 -0
  31. data/lib/nordlet/webhooks/types/subscriptions_rotate_secret_webhooks_response_last_delivery_status.rb +15 -0
  32. data/lib/nordlet.rb +20 -0
  33. data/reference.md +437 -11
  34. metadata +22 -2
@@ -10,6 +10,7 @@ module Nordlet
10
10
  SECRET = "secret"
11
11
  SELECT = "select"
12
12
  URL = "url"
13
+ HOST = "host"
13
14
  CERTIFICATE = "certificate"
14
15
  end
15
16
  end
@@ -10,6 +10,7 @@ module Nordlet
10
10
  SECRET = "secret"
11
11
  SELECT = "select"
12
12
  URL = "url"
13
+ HOST = "host"
13
14
  CERTIFICATE = "certificate"
14
15
  end
15
16
  end
@@ -51,7 +51,10 @@ module Nordlet
51
51
  # `sale_invoice.peppol_failed`; a received-document event fetches the document from the access point, stores it as
52
52
  # a document capture with the matched supplier, emits `document_capture.peppol_received` and marks it read at the
53
53
  # access point (a document already stored is skipped). `handled` is false when the event matched no invoice or
54
- # document. Answers 404 when no company uses that provider account, 401 when the signature does not match.
54
+ # document. A status is not moved back: pending, failed, delivered and rejected come in that order, and an event
55
+ # with an earlier status than the stored one changes nothing. Answers 401, with the same body, when no company
56
+ # uses that provider account, when the signature does not match and, for e-invoice.be, when the `created_at` of
57
+ # the event is more than 5 minutes from the server time.
55
58
  #
56
59
  # @param request_options [Hash]
57
60
  # @param params [Hash]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nordlet
4
- VERSION = "0.6.4"
4
+ VERSION = "0.6.5"
5
5
  end
@@ -11,8 +11,9 @@ module Nordlet
11
11
  end
12
12
 
13
13
  # Register a webhook endpoint for the given event types (`*` for every event). The URL must be an https address
14
- # that resolves to a public network (422 otherwise). The signing secret is generated unless `secret` is given, and
15
- # this call is the only one that returns it.
14
+ # that resolves to a public network (422 otherwise). The signing secret is generated unless `secret` is given (at
15
+ # least 32 characters), and this call is the only one that returns it. Answers 503 when the platform encryption
16
+ # key is not configured.
16
17
  #
17
18
  # @param request_options [Hash]
18
19
  # @param params [Nordlet::Webhooks::Types::SubscriptionsCreateWebhooksRequest]
@@ -81,6 +82,44 @@ module Nordlet
81
82
  end
82
83
  end
83
84
 
85
+ # Replace the signing secret of a subscription and return the new one; this call is the only one that returns it.
86
+ # The secret is generated unless `secret` is given (at least 32 characters). For 24 hours `x-nordlet-signature-v2`
87
+ # carries two `v1=` values, one with the new secret and one with the previous one, so a receiver can switch
88
+ # secrets without refusing deliveries; `x-nordlet-signature` uses the new secret only. Answers 404 for an unknown
89
+ # subscription and 503 when the platform encryption key is not configured.
90
+ #
91
+ # @param request_options [Hash]
92
+ # @param params [Nordlet::Webhooks::Types::SubscriptionsRotateSecretWebhooksRequest]
93
+ # @option request_options [String] :base_url
94
+ # @option request_options [Hash{String => Object}] :additional_headers
95
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
96
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
97
+ # @option request_options [Integer] :timeout_in_seconds
98
+ #
99
+ # @return [Nordlet::Webhooks::Types::SubscriptionsRotateSecretWebhooksResponse]
100
+ def subscriptions_rotate_secret(request_options: {}, **params)
101
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
102
+ request = Nordlet::Internal::JSON::Request.new(
103
+ base_url: request_options[:base_url],
104
+ method: "POST",
105
+ path: "v1/webhooks/subscriptions/rotate-secret",
106
+ body: Nordlet::Webhooks::Types::SubscriptionsRotateSecretWebhooksRequest.new(params).to_h,
107
+ request_options: request_options
108
+ )
109
+ begin
110
+ response = @client.send(request)
111
+ rescue Net::HTTPRequestTimeout
112
+ raise Nordlet::Errors::TimeoutError
113
+ end
114
+ code = response.code.to_i
115
+ if code.between?(200, 299)
116
+ Nordlet::Webhooks::Types::SubscriptionsRotateSecretWebhooksResponse.load(response.body)
117
+ else
118
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
119
+ raise error_class.new(response.body, code: code)
120
+ end
121
+ end
122
+
84
123
  # Change the URL, event types or `isActive` flag of a subscription; at least one field is required (400) and a new
85
124
  # URL must be an https address that resolves to a public network (422). Setting `isActive` to true also clears
86
125
  # `pausedAt` and `consecutiveFailures`, which is how a subscription paused after 5 failed deliveries in a row is
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Webhooks
5
+ module Types
6
+ class SubscriptionsRotateSecretWebhooksRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :secret, -> { String }, optional: true, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Webhooks
5
+ module Types
6
+ class SubscriptionsRotateSecretWebhooksResponse < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :url, -> { String }, optional: false, nullable: false
10
+
11
+ field :events, -> { Internal::Types::Array[String] }, optional: false, nullable: false
12
+
13
+ field :is_active, -> { Internal::Types::Boolean }, optional: false, nullable: false, api_name: "isActive"
14
+
15
+ field :consecutive_failures, -> { Integer }, optional: false, nullable: false, api_name: "consecutiveFailures"
16
+
17
+ field :last_delivery_status, -> { Nordlet::Webhooks::Types::SubscriptionsRotateSecretWebhooksResponseLastDeliveryStatus }, optional: false, nullable: true, api_name: "lastDeliveryStatus"
18
+
19
+ field :last_delivery_at, -> { String }, optional: false, nullable: true, api_name: "lastDeliveryAt"
20
+
21
+ field :paused_at, -> { String }, optional: false, nullable: true, api_name: "pausedAt"
22
+
23
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
24
+
25
+ field :secret, -> { String }, optional: false, nullable: false
26
+
27
+ field :previous_secret_expires_at, -> { String }, optional: false, nullable: false, api_name: "previousSecretExpiresAt"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Webhooks
5
+ module Types
6
+ module SubscriptionsRotateSecretWebhooksResponseLastDeliveryStatus
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ PENDING = "pending"
10
+ DELIVERED = "delivered"
11
+ FAILED = "failed"
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/nordlet.rb CHANGED
@@ -2322,6 +2322,8 @@ require_relative "nordlet/webhooks/types/subscriptions_list_webhooks_request_fil
2322
2322
  require_relative "nordlet/webhooks/types/subscriptions_list_webhooks_response_rows_item_last_delivery_status"
2323
2323
  require_relative "nordlet/webhooks/types/subscriptions_list_webhooks_response_rows_item"
2324
2324
  require_relative "nordlet/webhooks/types/subscriptions_list_webhooks_response"
2325
+ require_relative "nordlet/webhooks/types/subscriptions_rotate_secret_webhooks_response_last_delivery_status"
2326
+ require_relative "nordlet/webhooks/types/subscriptions_rotate_secret_webhooks_response"
2325
2327
  require_relative "nordlet/webhooks/types/subscriptions_update_webhooks_request_events_item"
2326
2328
  require_relative "nordlet/webhooks/types/subscriptions_update_webhooks_response_last_delivery_status"
2327
2329
  require_relative "nordlet/webhooks/types/subscriptions_update_webhooks_response"
@@ -2891,6 +2893,10 @@ require_relative "nordlet/account/types/export_account_response_billing_accounts
2891
2893
  require_relative "nordlet/account/types/export_account_response_credit_transactions_item_site"
2892
2894
  require_relative "nordlet/account/types/export_account_response_credit_transactions_item"
2893
2895
  require_relative "nordlet/account/types/export_account_response_audit_entries_item"
2896
+ require_relative "nordlet/account/types/export_account_response_auth_events_item"
2897
+ require_relative "nordlet/account/types/export_account_response_api_keys_item"
2898
+ require_relative "nordlet/account/types/export_account_response_oauth_grants_item"
2899
+ require_relative "nordlet/account/types/export_account_response_referral_points_item"
2894
2900
  require_relative "nordlet/account/types/export_account_response"
2895
2901
  require_relative "nordlet/account/types/delete_account_response"
2896
2902
  require_relative "nordlet/account/types/referral_get_account_response_rates"
@@ -2904,6 +2910,13 @@ require_relative "nordlet/account/types/table_settings_list_account_response"
2904
2910
  require_relative "nordlet/account/types/oauth_authorize_describe_account_response"
2905
2911
  require_relative "nordlet/account/types/oauth_authorize_approve_account_response"
2906
2912
  require_relative "nordlet/account/types/oauth_authorize_deny_account_response"
2913
+ require_relative "nordlet/account/types/two_factor_get_account_response_setup"
2914
+ require_relative "nordlet/account/types/two_factor_get_account_response"
2915
+ require_relative "nordlet/account/types/two_factor_setup_account_response"
2916
+ require_relative "nordlet/account/types/two_factor_enable_account_response"
2917
+ require_relative "nordlet/account/types/two_factor_verify_account_response"
2918
+ require_relative "nordlet/account/types/two_factor_recovery_codes_regenerate_account_response"
2919
+ require_relative "nordlet/account/types/two_factor_disable_account_response"
2907
2920
  require_relative "nordlet/types/error_response_error_code"
2908
2921
  require_relative "nordlet/types/error_response_error"
2909
2922
  require_relative "nordlet/types/error_response"
@@ -3474,6 +3487,7 @@ require_relative "nordlet/audit/types/list_audit_request"
3474
3487
  require_relative "nordlet/webhooks/client"
3475
3488
  require_relative "nordlet/webhooks/types/subscriptions_create_webhooks_request"
3476
3489
  require_relative "nordlet/webhooks/types/subscriptions_list_webhooks_request"
3490
+ require_relative "nordlet/webhooks/types/subscriptions_rotate_secret_webhooks_request"
3477
3491
  require_relative "nordlet/webhooks/types/subscriptions_update_webhooks_request"
3478
3492
  require_relative "nordlet/webhooks/types/subscriptions_delete_webhooks_request"
3479
3493
  require_relative "nordlet/webhooks/types/deliveries_list_webhooks_request"
@@ -3641,4 +3655,10 @@ require_relative "nordlet/account/types/table_settings_list_account_request"
3641
3655
  require_relative "nordlet/account/types/oauth_authorize_describe_account_request"
3642
3656
  require_relative "nordlet/account/types/oauth_authorize_approve_account_request"
3643
3657
  require_relative "nordlet/account/types/oauth_authorize_deny_account_request"
3658
+ require_relative "nordlet/account/types/two_factor_get_account_request"
3659
+ require_relative "nordlet/account/types/two_factor_setup_account_request"
3660
+ require_relative "nordlet/account/types/two_factor_enable_account_request"
3661
+ require_relative "nordlet/account/types/two_factor_verify_account_request"
3662
+ require_relative "nordlet/account/types/two_factor_recovery_codes_regenerate_account_request"
3663
+ require_relative "nordlet/account/types/two_factor_disable_account_request"
3644
3664
  require_relative "nordlet/environment"