conekta 0.4.8 → 0.5.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 +8 -8
- data/CHANGELOG +9 -1
- data/lib/conekta.rb +2 -1
- data/lib/conekta/conekta_object.rb +3 -0
- data/lib/conekta/util.rb +1 -0
- data/lib/conekta/version.rb +1 -1
- data/lib/conekta/webhook.rb +10 -0
- data/spec/conekta_spec.rb +29 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTIyMTc4YjE3NDdjYjNlMWJkNWVkZjU0MGYzYjBiMTNhNzA5MjYzNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWExNWM4MDI0ZGM5NjRjODk5ZjllZmNjNzg3M2IwMDhmMjc5YzEwYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTIzYjQ0YTdjNzJlZTYwZDY3MGE3OTczYTc2ZjNhZTI1NWY3OTVlNTU0ZTFm
|
10
|
+
NzQ2MDEwNzA3MTc5OWY1NWJjNjIzZmFjZmY1ZmMwMTMxMTUwNzVhMDkwZmM5
|
11
|
+
ZTcwYTExMzBlMTA4ZjJiMzY5OTA1MTE5ZDE0MDFkNDFhMzU0ZDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWQ1YWFmMzdmMmZlYWI5ZWRhNmJjNjM4Zjg3NGE3YzcxYjA2YzhlNGZhOTc2
|
14
|
+
MzI4Yzc0NGMwNmEyYjJlMjA1ZDEwNDZkZjNiNzdmNDFmZmExZmVmMWE3ZTI3
|
15
|
+
ZDM4MDI4YTMzNDQ3YjViMmU1MGMwNmQ5OWZiYjg3MjgzODFkZWQ=
|
data/CHANGELOG
CHANGED
data/lib/conekta.rb
CHANGED
@@ -28,13 +28,14 @@ require "conekta/payee"
|
|
28
28
|
require "conekta/payout"
|
29
29
|
require "conekta/payout_method"
|
30
30
|
require "conekta/method"
|
31
|
+
require "conekta/webhook"
|
31
32
|
require "conekta/webhook_log"
|
32
33
|
|
33
34
|
module Conekta
|
34
35
|
I18n.load_path += Dir[File.join(File.expand_path('../..', __FILE__), 'locales', '*.{rb,yml}').to_s]
|
35
36
|
|
36
37
|
@api_base = 'https://api.conekta.io'
|
37
|
-
@api_version = '0.
|
38
|
+
@api_version = '1.0.0'
|
38
39
|
@locale = 'es'
|
39
40
|
|
40
41
|
def self.api_base
|
@@ -51,6 +51,9 @@ module Conekta
|
|
51
51
|
self.class.name.split('::')[-1]
|
52
52
|
end
|
53
53
|
def create_attr(k,v)
|
54
|
+
# Conflict with Resource Class Url
|
55
|
+
k = "webhook_url" if k.to_s == "url"
|
56
|
+
# Conflict with Resource Class Url
|
54
57
|
create_method( "#{k}=".to_sym ) { |val|
|
55
58
|
instance_variable_set( "@" + k, val)
|
56
59
|
}
|
data/lib/conekta/util.rb
CHANGED
data/lib/conekta/version.rb
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
module Conekta
|
2
|
+
class Webhook < Resource
|
3
|
+
include Conekta::Operations::Find
|
4
|
+
include Conekta::Operations::Where
|
5
|
+
include Conekta::Operations::Create
|
6
|
+
include Conekta::Operations::Delete
|
7
|
+
include Conekta::Operations::Update
|
8
|
+
include Conekta::Operations::CustomAction
|
9
|
+
end
|
10
|
+
end
|
data/spec/conekta_spec.rb
CHANGED
@@ -386,4 +386,33 @@ describe :conekta_tests do
|
|
386
386
|
plan.deleted.should eq(true)
|
387
387
|
end
|
388
388
|
end
|
389
|
+
describe :webhook_tests do
|
390
|
+
p "webhook tests"
|
391
|
+
before :each do
|
392
|
+
@events = { events: ["charge.created", "charge.paid", "charge.under_fraud_review",
|
393
|
+
"charge.fraudulent", "charge.refunded", "charge.created", "customer.created",
|
394
|
+
"customer.updated", "customer.deleted", "webhook.created", "webhook.updated",
|
395
|
+
"webhook.deleted", "charge.chargeback.created", "charge.chargeback.updated",
|
396
|
+
"charge.chargeback.under_review", "charge.chargeback.lost", "charge.chargeback.won",
|
397
|
+
"payout.created", "payout.retrying", "payout.paid_out", "payout.failed",
|
398
|
+
"plan.created", "plan.updated", "plan.deleted", "subscription.created",
|
399
|
+
"subscription.paused", "subscription.resumed", "subscription.canceled",
|
400
|
+
"subscription.expired", "subscription.updated", "subscription.paid",
|
401
|
+
"subscription.payment_failed", "payee.created", "payee.updated",
|
402
|
+
"payee.deleted", "payee.payout_method.created",
|
403
|
+
"payee.payout_method.updated", "payee.payout_method.deleted"] }
|
404
|
+
@url = { url: "http://localhost:3000/my_listener" }
|
405
|
+
end
|
406
|
+
it "succesful get charge" do
|
407
|
+
events = @events
|
408
|
+
url = @url
|
409
|
+
webhook = Conekta::Webhook.create(url.merge(events))
|
410
|
+
webhook.webhook_url.should eq(url[:url])
|
411
|
+
webhook = Conekta::Webhook.find(webhook.id)
|
412
|
+
webhook.webhook_url.should eq(url[:url])
|
413
|
+
webhook.update({url: "http://localhost:2000/my_listener"})
|
414
|
+
webhook.webhook_url.should eq("http://localhost:2000/my_listener")
|
415
|
+
webhook.delete
|
416
|
+
end
|
417
|
+
end
|
389
418
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conekta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MauricioMurga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/conekta/token.rb
|
135
135
|
- lib/conekta/util.rb
|
136
136
|
- lib/conekta/version.rb
|
137
|
+
- lib/conekta/webhook.rb
|
137
138
|
- lib/conekta/webhook_log.rb
|
138
139
|
- lib/ssl_data/ca_bundle.crt
|
139
140
|
- locales/en.yml
|