web_function 0.6.0 → 0.8.0
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/README.md +435 -14
- data/lib/web_function/argument.rb +2 -14
- data/lib/web_function/attribute.rb +2 -13
- data/lib/web_function/client.rb +39 -1
- data/lib/web_function/endpoint.rb +7 -15
- data/lib/web_function/object_schema.rb +135 -0
- data/lib/web_function/package.rb +41 -1
- data/lib/web_function/request.rb +1 -0
- data/lib/web_function/type/any.rb +48 -0
- data/lib/web_function/type/array_of.rb +58 -0
- data/lib/web_function/type/base.rb +89 -0
- data/lib/web_function/type/union.rb +54 -0
- data/lib/web_function/type.rb +140 -0
- data/lib/web_function/utils.rb +23 -0
- data/lib/web_function/version.rb +1 -1
- data/lib/web_function.rb +2 -0
- metadata +35 -2
- data/test.rb +0 -43
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: web_function
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robin Clart
|
|
@@ -9,6 +9,34 @@ bindir: exe
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: irb
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: logger
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
12
40
|
- !ruby/object:Gem::Dependency
|
|
13
41
|
name: excon
|
|
14
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -61,14 +89,19 @@ files:
|
|
|
61
89
|
- lib/web_function/documented_error.rb
|
|
62
90
|
- lib/web_function/endpoint.rb
|
|
63
91
|
- lib/web_function/flaggable.rb
|
|
92
|
+
- lib/web_function/object_schema.rb
|
|
64
93
|
- lib/web_function/package.rb
|
|
65
94
|
- lib/web_function/pipeline.rb
|
|
66
95
|
- lib/web_function/promise.rb
|
|
67
96
|
- lib/web_function/request.rb
|
|
97
|
+
- lib/web_function/type.rb
|
|
98
|
+
- lib/web_function/type/any.rb
|
|
99
|
+
- lib/web_function/type/array_of.rb
|
|
100
|
+
- lib/web_function/type/base.rb
|
|
101
|
+
- lib/web_function/type/union.rb
|
|
68
102
|
- lib/web_function/utils.rb
|
|
69
103
|
- lib/web_function/version.rb
|
|
70
104
|
- sig/web_function.rbs
|
|
71
|
-
- test.rb
|
|
72
105
|
homepage: https://github.com/robinclart/web_function
|
|
73
106
|
licenses:
|
|
74
107
|
- MIT
|
data/test.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require "web_function"
|
|
2
|
-
require "base64"
|
|
3
|
-
|
|
4
|
-
pipeline = WebFunction::Pipeline.new("http://localhost:55001/api/process-pipeline")
|
|
5
|
-
|
|
6
|
-
sdk = WebFunction::Client.from_package_endpoint("http://localhost:55001/api/sdk",
|
|
7
|
-
pipeline: pipeline,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
merchant = WebFunction::Client.from_package_endpoint("http://localhost:55001/api/merchants",
|
|
11
|
-
bearer_auth: "reservepay_u6BHU4diPq7MVZCUJu7Ppu81nTrfYP1fMYVS",
|
|
12
|
-
pipeline: pipeline,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
installations = merchant.list_installations
|
|
16
|
-
payment_session_id = sdk.select_payment_method(
|
|
17
|
-
merchant_id: "11",
|
|
18
|
-
installation_id: installations[0]["installation_id"],
|
|
19
|
-
amount: 10000,
|
|
20
|
-
currency: "THB",
|
|
21
|
-
payment_method: "PROMPTPAY",
|
|
22
|
-
)
|
|
23
|
-
payment_id = merchant.initiate_payment_flow(
|
|
24
|
-
amount: 10000,
|
|
25
|
-
currency: "THB",
|
|
26
|
-
capture: true,
|
|
27
|
-
return_url: "https://reservepay.com/",
|
|
28
|
-
payment_session_id: payment_session_id,
|
|
29
|
-
)
|
|
30
|
-
payment = merchant.find_payment(payment_id: payment_id)
|
|
31
|
-
|
|
32
|
-
p payment.resolve
|
|
33
|
-
p payment_session_id
|
|
34
|
-
|
|
35
|
-
sleep 1
|
|
36
|
-
|
|
37
|
-
qr_data = sdk.retrieve_qr_data(
|
|
38
|
-
merchant_id: "11",
|
|
39
|
-
installation_id: installations[0]["installation_id"],
|
|
40
|
-
payment_session_id: payment_session_id,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
p Base64.decode64(qr_data.resolve)
|