omise 0.7.2 → 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/CHANGELOG.md +4 -0
- data/lib/omise/all.rb +1 -0
- data/lib/omise/capability.rb +32 -0
- data/lib/omise/version.rb +1 -1
- data/test/fixtures/api.omise.co/capability-get.json +29 -0
- data/test/omise/test_capability.rb +30 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9abe1a4a8a9399c57f4e58786fce81fd2ed38f2ddeead5ff9627a31e60aa914b
|
4
|
+
data.tar.gz: bb8a391d081182e8137d2f6d946dbb7addd455f2f474fe09ed841c8f5fcaa570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 943b4939ec9f1921d9b82f321d09de30b74ac7c0e8280b6db1574898850809a67d320756102b73ed9d8733f1cf1957eccbc5595bf088d15481ac238e396bd90d
|
7
|
+
data.tar.gz: 30a76786b30c05720a989d88e35063f6ea88a4fa1c79ed6de95b66f978ab7da0898bb993ab9f199f3a2ad9ce7fdd2c03deb41d8ff17c328abddbae5370466ab5
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
An [unreleased] version is not available on rubygems and is subject to changes and must not be considered final. Elements of unreleased list may be edited or removed at any time.
|
4
4
|
|
5
|
+
## [0.8.0] 2019-11-04
|
6
|
+
|
7
|
+
- [Added] Capability object
|
8
|
+
|
5
9
|
## [0.7.2] 2019-09-30
|
6
10
|
|
7
11
|
- [Changed] Removed CA certificate pining
|
data/lib/omise/all.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "omise/object"
|
2
|
+
|
3
|
+
module Omise
|
4
|
+
class Capability < OmiseObject
|
5
|
+
self.endpoint = "/capability"
|
6
|
+
singleton!
|
7
|
+
|
8
|
+
PaymentMethod = Struct.new(
|
9
|
+
:object,
|
10
|
+
:name,
|
11
|
+
:currencies,
|
12
|
+
:card_brands,
|
13
|
+
:installment_terms
|
14
|
+
)
|
15
|
+
|
16
|
+
def self.resource_key
|
17
|
+
Omise.public_api_key
|
18
|
+
end
|
19
|
+
|
20
|
+
def payment_methods
|
21
|
+
self["payment_methods"].map do |payment_method|
|
22
|
+
PaymentMethod.new(
|
23
|
+
payment_method["object"],
|
24
|
+
payment_method["name"],
|
25
|
+
payment_method["currencies"],
|
26
|
+
payment_method["card_brands"],
|
27
|
+
payment_method["installment_terms"]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/omise/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"object": "capability",
|
3
|
+
"location": "/capability",
|
4
|
+
"payment_methods": [
|
5
|
+
{
|
6
|
+
"object": "payment_method",
|
7
|
+
"name": "card",
|
8
|
+
"currencies": [
|
9
|
+
"THB",
|
10
|
+
"JPY",
|
11
|
+
"USD",
|
12
|
+
"EUR",
|
13
|
+
"GBP",
|
14
|
+
"SGD",
|
15
|
+
"AUD",
|
16
|
+
"CHF",
|
17
|
+
"CNY",
|
18
|
+
"DKK",
|
19
|
+
"HKD"
|
20
|
+
],
|
21
|
+
"card_brands": [
|
22
|
+
"JCB",
|
23
|
+
"Visa",
|
24
|
+
"MasterCard"
|
25
|
+
],
|
26
|
+
"installment_terms": null
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "support"
|
2
|
+
|
3
|
+
class TestCapability < Omise::Test
|
4
|
+
setup do
|
5
|
+
@capability = Omise::Capability.retrieve
|
6
|
+
@payment_methods = @capability.payment_methods
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_that_we_can_retrieve_capabilities
|
10
|
+
assert_instance_of Omise::Capability, @capability
|
11
|
+
assert_equal "/capability", @capability.location
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_we_have_payment_backends
|
15
|
+
assert @payment_methods.is_a?(Array)
|
16
|
+
refute @payment_methods.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_that_we_can_list_payment_methods
|
20
|
+
payment_method = @payment_methods.first
|
21
|
+
|
22
|
+
assert_instance_of Array, @payment_methods
|
23
|
+
assert_instance_of Omise::Capability::PaymentMethod, payment_method
|
24
|
+
assert payment_method.respond_to?(:object)
|
25
|
+
assert payment_method.respond_to?(:name)
|
26
|
+
assert payment_method.respond_to?(:currencies)
|
27
|
+
assert payment_method.respond_to?(:card_brands)
|
28
|
+
assert payment_method.respond_to?(:installment_terms)
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omise
|
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
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/omise/attributes.rb
|
117
117
|
- lib/omise/balance.rb
|
118
118
|
- lib/omise/bank_account.rb
|
119
|
+
- lib/omise/capability.rb
|
119
120
|
- lib/omise/card.rb
|
120
121
|
- lib/omise/card_list.rb
|
121
122
|
- lib/omise/chain.rb
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- omise.gemspec
|
156
157
|
- test/fixtures/api.omise.co/account-get.json
|
157
158
|
- test/fixtures/api.omise.co/balance-get.json
|
159
|
+
- test/fixtures/api.omise.co/capability-get.json
|
158
160
|
- test/fixtures/api.omise.co/chains-get.json
|
159
161
|
- test/fixtures/api.omise.co/chains/acch_test_57io26ws5af7plco6k1-get.json
|
160
162
|
- test/fixtures/api.omise.co/chains/acch_test_57io26ws5af7plco6k1/revoke-post.json
|
@@ -228,6 +230,7 @@ files:
|
|
228
230
|
- test/omise/test_account.rb
|
229
231
|
- test/omise/test_attributes.rb
|
230
232
|
- test/omise/test_balance.rb
|
233
|
+
- test/omise/test_capability.rb
|
231
234
|
- test/omise/test_card.rb
|
232
235
|
- test/omise/test_chain.rb
|
233
236
|
- test/omise/test_charge.rb
|
@@ -280,6 +283,7 @@ summary: Omise Ruby client
|
|
280
283
|
test_files:
|
281
284
|
- test/fixtures/api.omise.co/account-get.json
|
282
285
|
- test/fixtures/api.omise.co/balance-get.json
|
286
|
+
- test/fixtures/api.omise.co/capability-get.json
|
283
287
|
- test/fixtures/api.omise.co/chains-get.json
|
284
288
|
- test/fixtures/api.omise.co/chains/acch_test_57io26ws5af7plco6k1-get.json
|
285
289
|
- test/fixtures/api.omise.co/chains/acch_test_57io26ws5af7plco6k1/revoke-post.json
|
@@ -353,6 +357,7 @@ test_files:
|
|
353
357
|
- test/omise/test_account.rb
|
354
358
|
- test/omise/test_attributes.rb
|
355
359
|
- test/omise/test_balance.rb
|
360
|
+
- test/omise/test_capability.rb
|
356
361
|
- test/omise/test_card.rb
|
357
362
|
- test/omise/test_chain.rb
|
358
363
|
- test/omise/test_charge.rb
|