moneykit 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/docs/Body.md +42 -0
  5. data/docs/LinkProductRefreshWebhook.md +38 -0
  6. data/docs/LinkProductState.md +15 -0
  7. data/docs/ResponseHandleLinkWebhookEventRequestBodyWebhookPost.md +42 -0
  8. data/docs/TransactionUpdatesAvailableWebhook.md +30 -0
  9. data/lib/moneykit/models/body.rb +104 -0
  10. data/lib/moneykit/models/link_product_refresh_webhook.rb +417 -0
  11. data/lib/moneykit/models/link_product_state.rb +40 -0
  12. data/lib/moneykit/models/response_handle_link_webhook_event_request_body_webhook_post.rb +104 -0
  13. data/lib/moneykit/models/transaction_updates_available_webhook.rb +358 -0
  14. data/lib/moneykit/version.rb +1 -1
  15. data/lib/moneykit.rb +5 -0
  16. data/spec/models/body_spec.rb +21 -0
  17. data/spec/models/link_product_refresh_webhook_spec.rb +108 -0
  18. data/spec/models/link_product_state_spec.rb +30 -0
  19. data/spec/models/response_handle_link_webhook_event_request_body_webhook_post_spec.rb +21 -0
  20. data/spec/models/transaction_updates_available_webhook_spec.rb +84 -0
  21. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  22. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  23. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  24. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  25. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  26. metadata +116 -96
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77e641853224a0cb54735f617cabd803c57cd155837e9582a9a7164369052476
4
- data.tar.gz: 311fb1b63164f51ba9cb2b65349829d1778ac145d6e5cc768104eaaed187d0cd
3
+ metadata.gz: af6107a5a9741bb106b5635c8688fc4cfc5b2d4555d04a14b008e6e38c611843
4
+ data.tar.gz: 591755fa72311e80bb3260a2c06426bded21b4a9173b3b841b29dd411d3bd447
5
5
  SHA512:
6
- metadata.gz: 430385bb0b5b87a8bd1a69e244d13fd34a48e3005e500bde4fcc5eda7ffcbfd564fce87114d868cf1a4a5f4ee70a161039db08ce20bf8a80d40fd840e83c3861
7
- data.tar.gz: 04c1371e81b00a9adb8cd99ad9cb44d06a7b9fccd29b512cf708009cb44c4939474459b80dcee084e4f8bfa86a232c6bef0af79b8066b91b2a865d946c5d247d
6
+ metadata.gz: 48de68e9aa312cd396bde1550a69ff2df6773f5025379e28a871ce7c92432e1a5895ae180cffdfff72bf731b1a0a929a051b878e176ff5bf19496a9ea941a213
7
+ data.tar.gz: 0dfd9fa461ed1a201f68c97d8a0d6bc090554deaa46faf31c2ab97b34c95b3461856d59c3d27ed24b5484ebacbe892dab80f7bc87860a29956229eb227535214
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- moneykit (0.1.0)
4
+ moneykit (0.1.1)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart
7
7
 
data/README.md CHANGED
@@ -16,7 +16,7 @@ bundle add moneykit.gemspec
16
16
  or add the following to your `Gemfile`
17
17
 
18
18
  ```
19
- gem 'moneykit', '~> 0.1.0'
19
+ gem 'moneykit', '~> 0.1.1'
20
20
  ```
21
21
 
22
22
  ## Getting Started
data/docs/Body.md ADDED
@@ -0,0 +1,42 @@
1
+ # MoneyKit::Body
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **webhook_event** | **Object** | | [optional] |
8
+ | **webhook_major_version** | **Object** | | [optional] |
9
+ | **webhook_minor_version** | **Object** | | [optional] |
10
+ | **webhook_idempotency_key** | **Object** | | |
11
+ | **webhook_timestamp** | **Object** | | |
12
+ | **link_id** | **Object** | | |
13
+ | **link_tags** | **Object** | | |
14
+ | **state** | [**LinkProductState**](LinkProductState.md) | | |
15
+ | **error** | [**PublicLinkError**](PublicLinkError.md) | | [optional] |
16
+ | **error_message** | **Object** | | [optional] |
17
+ | **product** | [**Product**](Product.md) | | |
18
+ | **state_changed_at** | **Object** | | |
19
+ | **has_history** | **Object** | | |
20
+
21
+ ## Example
22
+
23
+ ```ruby
24
+ require 'moneykit'
25
+
26
+ instance = MoneyKit::Body.new(
27
+ webhook_event: null,
28
+ webhook_major_version: null,
29
+ webhook_minor_version: null,
30
+ webhook_idempotency_key: null,
31
+ webhook_timestamp: null,
32
+ link_id: null,
33
+ link_tags: null,
34
+ state: null,
35
+ error: null,
36
+ error_message: null,
37
+ product: null,
38
+ state_changed_at: null,
39
+ has_history: null
40
+ )
41
+ ```
42
+
@@ -0,0 +1,38 @@
1
+ # MoneyKit::LinkProductRefreshWebhook
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **webhook_event** | **String** | | [optional][default to &#39;link.product_refresh&#39;] |
8
+ | **webhook_major_version** | **Integer** | | [optional][default to WEBHOOK_MAJOR_VERSION::N1] |
9
+ | **webhook_minor_version** | **Integer** | | [optional][default to WEBHOOK_MINOR_VERSION::N0] |
10
+ | **webhook_idempotency_key** | **String** | | |
11
+ | **webhook_timestamp** | **Time** | | |
12
+ | **link_id** | **String** | | |
13
+ | **link_tags** | **Array&lt;String&gt;** | | |
14
+ | **product** | [**Product**](Product.md) | | |
15
+ | **state** | [**LinkProductState**](LinkProductState.md) | | |
16
+ | **state_changed_at** | **Time** | | |
17
+ | **error_message** | **String** | | [optional] |
18
+
19
+ ## Example
20
+
21
+ ```ruby
22
+ require 'moneykit'
23
+
24
+ instance = MoneyKit::LinkProductRefreshWebhook.new(
25
+ webhook_event: null,
26
+ webhook_major_version: null,
27
+ webhook_minor_version: null,
28
+ webhook_idempotency_key: null,
29
+ webhook_timestamp: null,
30
+ link_id: null,
31
+ link_tags: null,
32
+ product: null,
33
+ state: null,
34
+ state_changed_at: null,
35
+ error_message: null
36
+ )
37
+ ```
38
+
@@ -0,0 +1,15 @@
1
+ # MoneyKit::LinkProductState
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'moneykit'
12
+
13
+ instance = MoneyKit::LinkProductState.new()
14
+ ```
15
+
@@ -0,0 +1,42 @@
1
+ # MoneyKit::ResponseHandleLinkWebhookEventRequestBodyWebhookPost
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **webhook_event** | **Object** | | [optional] |
8
+ | **webhook_major_version** | **Object** | | [optional] |
9
+ | **webhook_minor_version** | **Object** | | [optional] |
10
+ | **webhook_idempotency_key** | **Object** | | |
11
+ | **webhook_timestamp** | **Object** | | |
12
+ | **link_id** | **Object** | | |
13
+ | **link_tags** | **Object** | | |
14
+ | **state** | [**LinkProductState**](LinkProductState.md) | | |
15
+ | **error** | [**PublicLinkError**](PublicLinkError.md) | | [optional] |
16
+ | **error_message** | **Object** | | [optional] |
17
+ | **product** | [**Product**](Product.md) | | |
18
+ | **state_changed_at** | **Object** | | |
19
+ | **has_history** | **Object** | | |
20
+
21
+ ## Example
22
+
23
+ ```ruby
24
+ require 'moneykit'
25
+
26
+ instance = MoneyKit::ResponseHandleLinkWebhookEventRequestBodyWebhookPost.new(
27
+ webhook_event: null,
28
+ webhook_major_version: null,
29
+ webhook_minor_version: null,
30
+ webhook_idempotency_key: null,
31
+ webhook_timestamp: null,
32
+ link_id: null,
33
+ link_tags: null,
34
+ state: null,
35
+ error: null,
36
+ error_message: null,
37
+ product: null,
38
+ state_changed_at: null,
39
+ has_history: null
40
+ )
41
+ ```
42
+
@@ -0,0 +1,30 @@
1
+ # MoneyKit::TransactionUpdatesAvailableWebhook
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **webhook_event** | **String** | | [optional][default to &#39;transactions.updates_available&#39;] |
8
+ | **webhook_major_version** | **Integer** | | [optional][default to WEBHOOK_MAJOR_VERSION::N1] |
9
+ | **webhook_minor_version** | **Integer** | | [optional][default to WEBHOOK_MINOR_VERSION::N0] |
10
+ | **webhook_idempotency_key** | **String** | | |
11
+ | **webhook_timestamp** | **Time** | | |
12
+ | **link_id** | **String** | | |
13
+ | **has_history** | **Boolean** | | |
14
+
15
+ ## Example
16
+
17
+ ```ruby
18
+ require 'moneykit'
19
+
20
+ instance = MoneyKit::TransactionUpdatesAvailableWebhook.new(
21
+ webhook_event: null,
22
+ webhook_major_version: null,
23
+ webhook_minor_version: null,
24
+ webhook_idempotency_key: null,
25
+ webhook_timestamp: null,
26
+ link_id: null,
27
+ has_history: null
28
+ )
29
+ ```
30
+
@@ -0,0 +1,104 @@
1
+ =begin
2
+ #MoneyKit API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MoneyKit
17
+ module Body
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'LinkProductRefreshWebhook',
23
+ :'LinkStateChangedWebhook',
24
+ :'TransactionUpdatesAvailableWebhook'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = MoneyKit.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise unless (data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+ end