nem_websocket_client 0.1.1 → 0.1.2

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: 000c7c676c886dbfc5adc6ccfe6bee6810f37549
4
- data.tar.gz: f40f37a9f9e910f7b267efdea81b9c85fd5b2f74
3
+ metadata.gz: 2df45c997bb66c051b32027899d70150f21ed689
4
+ data.tar.gz: 02aee5aa82ed5403560f4465eb78d9f328b98715
5
5
  SHA512:
6
- metadata.gz: c7e7384ac4d1451f0b9249ecbf2e9ef8fee18498a032554ce73c2903e4b9027a4766e35c2e1f56edc1222a75b80f565321ab6a47f1efe208328a9eff824f2f37
7
- data.tar.gz: 18a8940b2ca1ba40889de3476cbf2e9284ffd7b25eceb0aa89996ee6a67c60357b124d2f2d34dddba0865027b2fea3d2f8df3dff02ffbdce5e82d8942be01ce3
6
+ metadata.gz: daae243c9c9caedab656b326322174b25d01068fd3aa0559317627d6da39ea76ea2aa60216ddeeab61503257a67defcc8465e88a3ffa4975e1d86eb7c82614b9
7
+ data.tar.gz: 26452d9f5604ef8522b0ec4e4603d2f9deb01e67fc846de1c48264c3f83c0a1ce445578ec839789944a0b9ffb95ebce697f10d439803a3e99883082f17702e62
@@ -3,3 +3,6 @@ language: ruby
3
3
  rvm:
4
4
  - 2.3.3
5
5
  before_install: gem install bundler -v 1.16.1
6
+ script:
7
+ - bundle install
8
+ - bundle exec rspec
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nem_websocket_client (0.1.0)
4
+ nem_websocket_client (0.1.1)
5
5
  stomp_parser (~> 1.0.0)
6
6
  websocket-client-simple (~> 0.3.0)
7
7
 
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # NemWebsocketClient
2
- NemWebsocketClientはNEMのWebsocketを扱うためのシンプルなライブラリです。
2
+ [![Build Status](https://travis-ci.org/5hyn3/nem_websocket_client.svg?branch=master)](https://travis-ci.org/5hyn3/nem_websocket_client)
3
+
4
+ NemWebsocketClient is a simple library for handling NEM's Websocket
3
5
  [README_jp.md](README_jp.md)
4
6
  ## Installation
5
7
 
@@ -21,7 +23,7 @@ ws.connected do
21
23
  end
22
24
 
23
25
  ws.subscribe_block do |transaction|
24
- transaction["timeStamp"]
26
+ p transaction["timeStamp"]
25
27
  end
26
28
 
27
29
  ws.errors do |e|
@@ -38,13 +40,13 @@ end
38
40
  ```
39
41
 
40
42
  ## Test
43
+
41
44
  ```ruby
42
45
  gem install bundler
43
46
  bundle install
44
47
  rspec
45
48
  ```
46
49
 
47
-
48
50
  ## Development
49
51
 
50
52
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -62,3 +64,12 @@ The gem is available as open source under the terms of the [MIT License](https:/
62
64
  ## Code of Conduct
63
65
 
64
66
  Everyone interacting in the NemWebsocketClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/nem_websocket_client/blob/master/CODE_OF_CONDUCT.md).
67
+
68
+ ## Donation
69
+
70
+ It leads to motivation of developers.
71
+
72
+ NEM
73
+ ```
74
+ NCADQWTJUPTSDZ6XEIVIAR7GANIGJENVUAPN3OMD
75
+ ```
@@ -1,6 +1,7 @@
1
1
  # NemWebsocketClient
2
- NemWebsocketClient is a simple library for handling NEM's Websocket
3
- [README_jp.md](README_jp.md)
2
+ [![Build Status](https://travis-ci.org/5hyn3/nem_websocket_client.svg?branch=master)](https://travis-ci.org/5hyn3/nem_websocket_client)
3
+
4
+ NemWebsocketClientはNEMのWebsocketを扱うためのシンプルなライブラリです。
4
5
  ## Installation
5
6
 
6
7
  ```ruby
@@ -21,7 +22,7 @@ ws.connected do
21
22
  end
22
23
 
23
24
  ws.subscribe_block do |transaction|
24
- transaction["timeStamp"]
25
+ p transaction["timeStamp"]
25
26
  end
26
27
 
27
28
  ws.errors do |e|
@@ -62,3 +63,12 @@ The gem is available as open source under the terms of the [MIT License](https:/
62
63
  ## Code of Conduct
63
64
 
64
65
  Everyone interacting in the NemWebsocketClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/nem_websocket_client/blob/master/CODE_OF_CONDUCT.md).
66
+
67
+ ## Donation
68
+
69
+ 開発者のモチベアップや、他のプロダクトの開発に役立てられます。
70
+
71
+ NEM
72
+ ```
73
+ NCADQWTJUPTSDZ6XEIVIAR7GANIGJENVUAPN3OMD
74
+ ```
@@ -62,37 +62,37 @@ module NemWebsocketClient
62
62
  end
63
63
 
64
64
  def subscribe_owned_namespace(address,&fun)
65
- @ws.subscribe_owned_namespace_func = fun
65
+ @ws.subscribe_owned_namespace_func[address] = fun
66
66
  send_subscribe_stomp(@@owned_namespace_path + address)
67
67
  end
68
68
 
69
69
  def subscribe_owned_mosaic(address,&fun)
70
- @ws.subscribe_owned_mosaic_func = fun
70
+ @ws.subscribe_owned_mosaic_func[address] = fun
71
71
  send_subscribe_stomp(@@owned_mosaic_path + address)
72
72
  end
73
73
 
74
74
  def subscribe_owned_mosaic_definition(address,&fun)
75
- @ws.subscribe_owned_mosaic_definition_func = fun
75
+ @ws.subscribe_owned_mosaic_definition_func[address] = fun
76
76
  send_subscribe_stomp(@@owned_mosaic_definition_path + address)
77
77
  end
78
78
 
79
79
  def subscribe_transaction(address,&fun)
80
- @ws.subscribe_transaction_func = fun
80
+ @ws.subscribe_transaction_func[address] = fun
81
81
  send_subscribe_stomp(@@transaction_path + address)
82
82
  end
83
83
 
84
84
  def subscribe_unconfirmed_transaction(address,&fun)
85
- @ws.subscribe_unconfirmed_transaction_func = fun
85
+ @ws.subscribe_unconfirmed_transaction_func[address] = fun
86
86
  send_subscribe_stomp(@@unconfirmed_transaction_path + address)
87
87
  end
88
88
 
89
89
  def subscribe_recenttransactions(address,&fun)
90
- @ws.subscribe_recenttransactions_func = fun
90
+ @ws.subscribe_recenttransactions_func[address] = fun
91
91
  send_subscribe_stomp(@@recenttransactions_path + address)
92
92
  end
93
93
 
94
94
  def subscribe_account(address,&fun)
95
- @ws.subscribe_account_func = fun
95
+ @ws.subscribe_account_func[address] = fun
96
96
  send_subscribe_stomp(@@account_path + address)
97
97
  end
98
98
 
@@ -173,27 +173,28 @@ module NemWebsocketClient
173
173
  if frame.command == "MESSAGE"
174
174
  result = JSON.parse(frame.body)
175
175
  destination = frame.headers["destination"]
176
- address = destination.match(/\w{40}/)
177
- destination.slice!(address.to_s) unless address.nil?
176
+ address_match = destination.match(/\w{40}/)
177
+ address = address_match.to_s
178
+ destination.slice!(address) unless address.nil?
178
179
  case destination
179
180
  when @@block_path
180
181
  subscribe_block_func.call(result)
181
182
  when @@block_height_path
182
183
  subscribe_block_height_func.call(result)
183
184
  when @@unconfirmed_transaction_path
184
- subscribe_unconfirmed_transaction_func.call(result,address)
185
+ subscribe_unconfirmed_transaction_func[address].call(result,address)
185
186
  when @@recenttransactions_path
186
- subscribe_recenttransactions_func.call(result,address)
187
+ subscribe_recenttransactions_func[address].call(result,address)
187
188
  when @@account_path
188
- subscribe_account_func.call(result,address)
189
+ subscribe_account_func[address].call(result,address)
189
190
  when @@owned_namespace_path
190
- subscribe_owned_namespace_func.call(result,address)
191
+ subscribe_owned_namespace_func[address].call(result,address)
191
192
  when @@owned_mosaic_path
192
- subscribe_owned_mosaic_func.call(result,address)
193
+ subscribe_owned_mosaic_func[address].call(result,address)
193
194
  when @@owned_mosaic_definition_path
194
- subscribe_owned_mosaic_definition_func.call(result,address)
195
+ subscribe_owned_mosaic_definition_func[address].call(result,address)
195
196
  when @@transaction_path
196
- subscribe_owned_mosaic_func.call(result,address)
197
+ subscribe_owned_mosaic_func[address].call(result,address)
197
198
  end
198
199
  end
199
200
  end
@@ -220,6 +221,13 @@ module NemWebsocketClient
220
221
  @ws.singleton_class.class_eval{ attr_accessor :send_stomps }
221
222
  @ws.subscribe_stomps = []
222
223
  @ws.send_stomps = []
224
+ @ws.subscribe_owned_namespace_func = {}
225
+ @ws.subscribe_owned_mosaic_func = {}
226
+ @ws.subscribe_owned_mosaic_definition_func = {}
227
+ @ws.subscribe_transaction_func = {}
228
+ @ws.subscribe_unconfirmed_transaction_func = {}
229
+ @ws.subscribe_recenttransactions_func = {}
230
+ @ws.subscribe_account_func = {}
223
231
  end
224
232
 
225
233
  def generate_sub_id
@@ -1,3 +1,3 @@
1
1
  module NemWebsocketClient
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nem_websocket_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - shyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-09 00:00:00.000000000 Z
11
+ date: 2018-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stomp_parser