omise 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7f0f0af87f90ea42296a85216fee5da2c49bbd7
4
- data.tar.gz: c53aca0d0ea2b064ff86c02c5999a513d7f77b36
3
+ metadata.gz: 6582f42a8eff692792f15819c73d604bfa94e295
4
+ data.tar.gz: 6f28d4f5b34c5e85f041bf19a12cb844179d0ef0
5
5
  SHA512:
6
- metadata.gz: ba34266b22f1a00251c20e85dd5384ebfa4d2f7a9057eb77a5351e6c1d6f14e1ec8e9755a87ce6f0c5cbb0b54604e888bd07c727639c096bd07446a2ef48a571
7
- data.tar.gz: 66d601cd6d4975c281791643f3f1646d8a83460cfae06f3c6dfcb71fc6c893a548641d8c18d2266fd71ea6aea1c093a0e9c88a593ac362157532d3e4dab437e7
6
+ metadata.gz: 7f28d94fde9630b4b3d07ffc25fcc4f6319c65f1edc6264055b90bd9503c857a7a44cdfc58b94c4082fa6952c8f1a539cc8a93d3b573895e29ed74c682a3d9bd
7
+ data.tar.gz: 5b1fc4c28f7d80eb0018b5953049b6e23fb5b834cc4b4544cadadfe42284f254ca5b2fad5c949514bc5bbd0386ecb9a380e55e1998692390158b0071598ddb43
@@ -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.3.0] 2016-02-18
6
+
7
+ - [Added] Add Events API
8
+
5
9
  ## [0.2.1] 2015-12-01
6
10
 
7
11
  - [Added] Add fetching options to customer cards (6ef31e6)
@@ -4,6 +4,7 @@ require "omise/card"
4
4
  require "omise/charge"
5
5
  require "omise/customer"
6
6
  require "omise/dispute"
7
+ require "omise/event"
7
8
  require "omise/recipient"
8
9
  require "omise/refund"
9
10
  require "omise/token"
@@ -0,0 +1,20 @@
1
+ require "omise/object"
2
+ require "omise/list"
3
+
4
+ module Omise
5
+ class Event < OmiseObject
6
+ self.endpoint = "/events"
7
+
8
+ def self.retrieve(id, attributes = {})
9
+ new resource(location(id), attributes).get(attributes)
10
+ end
11
+
12
+ def self.list(attributes = {})
13
+ List.new resource(location, attributes).get(attributes)
14
+ end
15
+
16
+ def reload(attributes = {})
17
+ assign_attributes resource(attributes).get(attributes)
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Omise
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,76 @@
1
+ {
2
+ "object": "list",
3
+ "from": "1970-01-01T00:00:00+00:00",
4
+ "to": "2015-01-15T05:04:30+00:00",
5
+ "offset": 0,
6
+ "limit": 20,
7
+ "total": 1,
8
+ "data": [
9
+ {
10
+ "object": "event",
11
+ "id": "evnt_test_52cin5n9bb6lytxduh9",
12
+ "livemode": true,
13
+ "location": "/events/evnt_test_52cin5n9bb6lytxduh9",
14
+ "key": "charge.create",
15
+ "created": "2015-12-14T09:02:29Z",
16
+ "data": {
17
+ "object": "charge",
18
+ "id": "chrg_test_4yq7duw15p9hdrjp8oq",
19
+ "livemode": false,
20
+ "location": "/charges/chrg_test_4yq7duw15p9hdrjp8oq",
21
+ "amount": 100000,
22
+ "currency": "thb",
23
+ "description": "Charge for order 3947",
24
+ "capture": true,
25
+ "authorized": true,
26
+ "captured": true,
27
+ "transaction": "trxn_test_4yq7duwb9jts1vxgqua",
28
+ "refunded": 10000,
29
+ "refunds": {
30
+ "object": "list",
31
+ "from": "1970-01-01T00:00:00+00:00",
32
+ "to": "2015-01-16T07:23:49+00:00",
33
+ "offset": 0,
34
+ "limit": 20,
35
+ "total": 1,
36
+ "data": [
37
+ {
38
+ "object": "refund",
39
+ "id": "rfnd_test_4yqmv79ahghsiz23y3c",
40
+ "location": "/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c",
41
+ "amount": 10000,
42
+ "currency": "thb",
43
+ "charge": "chrg_test_4yq7duw15p9hdrjp8oq",
44
+ "transaction": "trxn_test_4yqmv79fzpy0gmz5mmq",
45
+ "created": "2015-01-16T07:23:45Z"
46
+ }
47
+ ],
48
+ "location": "/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds"
49
+ },
50
+ "failure_code": null,
51
+ "failure_message": null,
52
+ "card": {
53
+ "object": "card",
54
+ "id": "card_test_4yq6tuucl9h4erukfl0",
55
+ "livemode": false,
56
+ "location": "/customers/cust_test_4yq6txdpfadhbaqnwp3/cards/card_test_4yq6tuucl9h4erukfl0",
57
+ "country": "",
58
+ "city": "Bangkok",
59
+ "postal_code": "10320",
60
+ "financing": "",
61
+ "last_digits": "4242",
62
+ "brand": "Visa",
63
+ "expiration_month": 1,
64
+ "expiration_year": 2017,
65
+ "fingerprint": "sRF/oMw2UQJJp/WbU+2/ZbVzwROjpMf1lyhOHhOqziw=",
66
+ "name": "JOHN DOE",
67
+ "security_code_check": true,
68
+ "created": "2015-01-15T04:03:40Z"
69
+ },
70
+ "customer": "cust_test_4yq6txdpfadhbaqnwp3",
71
+ "ip": null,
72
+ "created": "2015-01-15T05:00:29Z"
73
+ }
74
+ }
75
+ ]
76
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "object": "event",
3
+ "id": "evnt_test_52cin5n9bb6lytxduh9",
4
+ "livemode": true,
5
+ "location": "/events/evnt_test_52cin5n9bb6lytxduh9",
6
+ "key": "charge.create",
7
+ "created": "2015-12-14T09:02:29Z",
8
+ "data": {
9
+ "object": "charge",
10
+ "id": "chrg_test_4yq7duw15p9hdrjp8oq",
11
+ "livemode": false,
12
+ "location": "/charges/chrg_test_4yq7duw15p9hdrjp8oq",
13
+ "amount": 100000,
14
+ "currency": "thb",
15
+ "description": "Charge for order 3947",
16
+ "capture": true,
17
+ "authorized": true,
18
+ "captured": true,
19
+ "transaction": "trxn_test_4yq7duwb9jts1vxgqua",
20
+ "refunded": 10000,
21
+ "refunds": {
22
+ "object": "list",
23
+ "from": "1970-01-01T00:00:00+00:00",
24
+ "to": "2015-01-16T07:23:49+00:00",
25
+ "offset": 0,
26
+ "limit": 20,
27
+ "total": 1,
28
+ "data": [
29
+ {
30
+ "object": "refund",
31
+ "id": "rfnd_test_4yqmv79ahghsiz23y3c",
32
+ "location": "/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c",
33
+ "amount": 10000,
34
+ "currency": "thb",
35
+ "charge": "chrg_test_4yq7duw15p9hdrjp8oq",
36
+ "transaction": "trxn_test_4yqmv79fzpy0gmz5mmq",
37
+ "created": "2015-01-16T07:23:45Z"
38
+ }
39
+ ],
40
+ "location": "/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds"
41
+ },
42
+ "failure_code": null,
43
+ "failure_message": null,
44
+ "card": {
45
+ "object": "card",
46
+ "id": "card_test_4yq6tuucl9h4erukfl0",
47
+ "livemode": false,
48
+ "location": "/customers/cust_test_4yq6txdpfadhbaqnwp3/cards/card_test_4yq6tuucl9h4erukfl0",
49
+ "country": "",
50
+ "city": "Bangkok",
51
+ "postal_code": "10320",
52
+ "financing": "",
53
+ "last_digits": "4242",
54
+ "brand": "Visa",
55
+ "expiration_month": 1,
56
+ "expiration_year": 2017,
57
+ "fingerprint": "sRF/oMw2UQJJp/WbU+2/ZbVzwROjpMf1lyhOHhOqziw=",
58
+ "name": "JOHN DOE",
59
+ "security_code_check": true,
60
+ "created": "2015-01-15T04:03:40Z"
61
+ },
62
+ "customer": "cust_test_4yq6txdpfadhbaqnwp3",
63
+ "ip": null,
64
+ "created": "2015-01-15T05:00:29Z"
65
+ }
66
+ }
@@ -0,0 +1,18 @@
1
+ require "support"
2
+
3
+ class TestEvent < Omise::Test
4
+ setup do
5
+ @event = Omise::Event.retrieve("evnt_test_52cin5n9bb6lytxduh9")
6
+ end
7
+
8
+ def test_that_we_can_list_all_events
9
+ events = Omise::Event.list
10
+
11
+ assert_instance_of Omise::List, events
12
+ end
13
+
14
+ def test_that_we_can_retrieve_a_event
15
+ assert_instance_of Omise::Event, @event
16
+ assert_equal "evnt_test_52cin5n9bb6lytxduh9", @event.id
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Clart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -107,6 +107,7 @@ files:
107
107
  - lib/omise/customer.rb
108
108
  - lib/omise/dispute.rb
109
109
  - lib/omise/error.rb
110
+ - lib/omise/event.rb
110
111
  - lib/omise/list.rb
111
112
  - lib/omise/object.rb
112
113
  - lib/omise/recipient.rb
@@ -152,6 +153,8 @@ files:
152
153
  - test/fixtures/api.omise.co/disputes/dspt_test_5089off452g5m5te7xs-patch.json
153
154
  - test/fixtures/api.omise.co/disputes/open-get.json
154
155
  - test/fixtures/api.omise.co/disputes/pending-get.json
156
+ - test/fixtures/api.omise.co/events-get.json
157
+ - test/fixtures/api.omise.co/events/evnt_test_52cin5n9bb6lytxduh9-get.json
155
158
  - test/fixtures/api.omise.co/recipients-get.json
156
159
  - test/fixtures/api.omise.co/recipients-post.json
157
160
  - test/fixtures/api.omise.co/recipients/recp_test_50894vc13y8z4v51iuc-delete.json
@@ -174,6 +177,7 @@ files:
174
177
  - test/omise/test_charge.rb
175
178
  - test/omise/test_customer.rb
176
179
  - test/omise/test_dispute.rb
180
+ - test/omise/test_event.rb
177
181
  - test/omise/test_recipient.rb
178
182
  - test/omise/test_refund.rb
179
183
  - test/omise/test_resource.rb
@@ -236,6 +240,8 @@ test_files:
236
240
  - test/fixtures/api.omise.co/disputes/dspt_test_5089off452g5m5te7xs-patch.json
237
241
  - test/fixtures/api.omise.co/disputes/open-get.json
238
242
  - test/fixtures/api.omise.co/disputes/pending-get.json
243
+ - test/fixtures/api.omise.co/events-get.json
244
+ - test/fixtures/api.omise.co/events/evnt_test_52cin5n9bb6lytxduh9-get.json
239
245
  - test/fixtures/api.omise.co/recipients-get.json
240
246
  - test/fixtures/api.omise.co/recipients-post.json
241
247
  - test/fixtures/api.omise.co/recipients/recp_test_50894vc13y8z4v51iuc-delete.json
@@ -258,6 +264,7 @@ test_files:
258
264
  - test/omise/test_charge.rb
259
265
  - test/omise/test_customer.rb
260
266
  - test/omise/test_dispute.rb
267
+ - test/omise/test_event.rb
261
268
  - test/omise/test_recipient.rb
262
269
  - test/omise/test_refund.rb
263
270
  - test/omise/test_resource.rb