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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8df44a5546d1ad6fbc96a2c30e4eced34ece59789f990ec20312437cb7455475
4
- data.tar.gz: 291d93352b25277afd38aeb9c688b18a3275056193d0f71a6431ffb336f0a595
3
+ metadata.gz: 5d0136e4cda23c6c143faae28ab072a0e1b4155028c311eaefff14903e57c3b4
4
+ data.tar.gz: 710183c97ffc4a867acad7830fd2e30fe23346a1fdffd742b59cbd3e8ca2f2a8
5
5
  SHA512:
6
- metadata.gz: 81c7904bf5619df3167c3c7b146a63a1cb206b0a36ef57d117a1b3ae30a6728cebf22fd2fb9fe67ef951146e924d7491abfecc549415a2b1a8ab009889142f0e
7
- data.tar.gz: 8286ffba3c9c6bca34758d4ad47ac871b272115fd302ec76261323e8bfb892568ab949f50330c8f5dae2e4e1e90680729bffe48e37c8bdb7d1de9fdf534283dc
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 = "YourCallback"
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 YourCallback
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
@@ -12,6 +12,7 @@ module PaxfulEngine
12
12
  has :paxful_key, classes: [NilClass, String]
13
13
  has :paxful_secret, classes: [NilClass, String]
14
14
  has :on_sync_callback
15
+ has :on_failure_callback
15
16
  end
16
17
 
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module PaxfulEngine
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
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.3.1
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-24 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config