moneykit 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/docs/Body.md +42 -0
- data/docs/LinkProductRefreshWebhook.md +38 -0
- data/docs/LinkProductState.md +15 -0
- data/docs/ResponseHandleLinkWebhookEventRequestBodyWebhookPost.md +42 -0
- data/docs/TransactionUpdatesAvailableWebhook.md +30 -0
- data/lib/moneykit/models/body.rb +104 -0
- data/lib/moneykit/models/link_product_refresh_webhook.rb +417 -0
- data/lib/moneykit/models/link_product_state.rb +40 -0
- data/lib/moneykit/models/response_handle_link_webhook_event_request_body_webhook_post.rb +104 -0
- data/lib/moneykit/models/transaction_updates_available_webhook.rb +358 -0
- data/lib/moneykit/version.rb +1 -1
- data/lib/moneykit.rb +5 -0
- data/spec/models/body_spec.rb +21 -0
- data/spec/models/link_product_refresh_webhook_spec.rb +108 -0
- data/spec/models/link_product_state_spec.rb +30 -0
- data/spec/models/response_handle_link_webhook_event_request_body_webhook_post_spec.rb +21 -0
- data/spec/models/transaction_updates_available_webhook_spec.rb +84 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
- metadata +116 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af6107a5a9741bb106b5635c8688fc4cfc5b2d4555d04a14b008e6e38c611843
|
4
|
+
data.tar.gz: 591755fa72311e80bb3260a2c06426bded21b4a9173b3b841b29dd411d3bd447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48de68e9aa312cd396bde1550a69ff2df6773f5025379e28a871ce7c92432e1a5895ae180cffdfff72bf731b1a0a929a051b878e176ff5bf19496a9ea941a213
|
7
|
+
data.tar.gz: 0dfd9fa461ed1a201f68c97d8a0d6bc090554deaa46faf31c2ab97b34c95b3461856d59c3d27ed24b5484ebacbe892dab80f7bc87860a29956229eb227535214
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
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 'link.product_refresh'] |
|
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<String>** | | |
|
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,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 'transactions.updates_available'] |
|
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
|