yolodice-client 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yolodice_client.rb +13 -1
  3. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4777876d939b40f70b4bdba8a119d73afacdf1a9
4
- data.tar.gz: d20844e3e1163eeb47d26a1ec4971732b5043877
3
+ metadata.gz: 762e3e360b919019ed7ce742c5a5355e4664c01d
4
+ data.tar.gz: 3517197f51c06d29c89e4396ed439b0425f56ffd
5
5
  SHA512:
6
- metadata.gz: 638e0e46a0a2f8d128a7b0e2468370fb2940d236f15dee52e5ab1e80962d01925db278628815d5821311b6833a0fca46adaf6412f6c6bd10b04d8916f989f8b2
7
- data.tar.gz: a2751949033cc6edcfca2440f1d52d43ce5015eb831a8a588c662e5e723eeb4b3be50d606d1812a1fbe582e154d1604ddfe291d88b5c59b85808ad52081655ab
6
+ metadata.gz: 63d26bd4416d62a1f02bb469768b1745a67bc182c4c5721b80aca3040ce296bb1598ad164d4af2cdf299f2cacbcc19e136af1ecd92da940c4b881d1a6920dfe9
7
+ data.tar.gz: 7f026921c0e2d51e8471d53d85ba0c4fae3b4a02548ebabab318cfcf16ede66e2c38fb72390449a1ecdc678d1a42399d2f35f1fe899be991642211fc7ffcc332
@@ -13,6 +13,13 @@ class YolodiceClient
13
13
  # <tt>OpenSSL::SSL::SSLSocket</tt> object created by the <tt>connect</tt> method.
14
14
  attr_reader :connection
15
15
 
16
+ # Proc for handling notifications from the server. This proc (if set) will be
17
+ # called each time the server sends a notification, i.e. a message that is not a
18
+ # response to any client call.
19
+ # The proc is given a single argument: the message hash.
20
+ # The proc is called in a separate thread.
21
+ attr_accessor :notification_proc
22
+
16
23
  ##
17
24
  # Initializes the client object. The method accepts an option hash with the following keys:
18
25
  # * <tt>:host</tt> -- defaults to <tt>api.yolodice.com</tt>
@@ -84,7 +91,12 @@ class YolodiceClient
84
91
  if message['id']
85
92
  # It must be a request from the server. We do not support it yet.
86
93
  else
87
- # No id, it must be a notification then. This can be implemented later.
94
+ # No id, it must be a notification then.
95
+ if notification_proc
96
+ Thread.new do
97
+ notification_proc.call message
98
+ end
99
+ end
88
100
  end
89
101
  end
90
102
  rescue StandardError => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yolodice-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ethan_nx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-ruby
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.8
27
+ - !ruby/object:Gem::Dependency
28
+ name: ffi
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.9.10
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.9'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.9.10
27
47
  description: A simple JSON-RPC2 client dedicated for YOLOdice.com API.
28
48
  email:
29
49
  executables: []