paxful_engine-rails 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -2
- data/app/services/paxful_engine/create_trade.rb +6 -0
- data/lib/paxful_engine.rb +1 -0
- data/lib/paxful_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d0136e4cda23c6c143faae28ab072a0e1b4155028c311eaefff14903e57c3b4
|
4
|
+
data.tar.gz: 710183c97ffc4a867acad7830fd2e30fe23346a1fdffd742b59cbd3e8ca2f2a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6983fb6ae6147222663f9a279dece25d68099d9a1c661faeacdec7e1ae00a895b3510e1e0a06b98186402bc9fc2107bccbdcf3a94ebd6f2bfbc88d2f4590167
|
7
|
+
data.tar.gz: fd1e259ac766bd185ac68af6188e64a20e95557b704b9177977f9b34fd72731ff6591b81ab1d5f2c98b55a87740488d9bb0ebd4b7b205414fe8dfb4d6addcdd1
|
data/README.md
CHANGED
@@ -34,7 +34,8 @@ Create an initializer in your Rails application:
|
|
34
34
|
PaxfulEngine.configure do |c|
|
35
35
|
c.paxful_key = "your paxful key"
|
36
36
|
c.paxful_secret = "your paxful secret"
|
37
|
-
c.on_sync_callback = "
|
37
|
+
c.on_sync_callback = "SyncCallback"
|
38
|
+
c.on_failure_callback = "FailureCallback"
|
38
39
|
end
|
39
40
|
```
|
40
41
|
|
@@ -45,7 +46,7 @@ It accepts a `Trade` as its only argument.
|
|
45
46
|
|
46
47
|
```
|
47
48
|
# example
|
48
|
-
class
|
49
|
+
class SyncCallback
|
49
50
|
|
50
51
|
def self.call(trade)
|
51
52
|
# do anything you want with this record
|
@@ -54,6 +55,25 @@ class YourCallback
|
|
54
55
|
end
|
55
56
|
```
|
56
57
|
|
58
|
+
#### c.on_failure_callback
|
59
|
+
|
60
|
+
An object that responds to `call` that gets executed when a trade cannot be created.
|
61
|
+
|
62
|
+
It accepts two arguments:
|
63
|
+
- exception
|
64
|
+
- payload
|
65
|
+
|
66
|
+
```
|
67
|
+
# example
|
68
|
+
class FailureCallback
|
69
|
+
|
70
|
+
def self.call(e, payload)
|
71
|
+
# log somewhere...
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
57
77
|
### Usage
|
58
78
|
|
59
79
|
Add this to your scheduler somewhere:
|
@@ -24,6 +24,12 @@ module PaxfulEngine
|
|
24
24
|
end
|
25
25
|
|
26
26
|
trade
|
27
|
+
|
28
|
+
rescue => exception
|
29
|
+
if PaxfulEngine.configuration.on_failure_callback.present?
|
30
|
+
callback = PaxfulEngine.configuration.on_failure_callback
|
31
|
+
callback.constantize.(exception, payload)
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
35
|
end
|
data/lib/paxful_engine.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paxful_engine-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Chavez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|