nem_websocket_client 0.1.0 → 0.1.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 +4 -4
- data/README.md +35 -14
- data/README_jp.md +64 -0
- data/lib/nem_websocket_client/client.rb +3 -3
- data/lib/nem_websocket_client/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 000c7c676c886dbfc5adc6ccfe6bee6810f37549
|
4
|
+
data.tar.gz: f40f37a9f9e910f7b267efdea81b9c85fd5b2f74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7e7384ac4d1451f0b9249ecbf2e9ef8fee18498a032554ce73c2903e4b9027a4766e35c2e1f56edc1222a75b80f565321ab6a47f1efe208328a9eff824f2f37
|
7
|
+
data.tar.gz: 18a8940b2ca1ba40889de3476cbf2e9284ffd7b25eceb0aa89996ee6a67c60357b124d2f2d34dddba0865027b2fea3d2f8df3dff02ffbdce5e82d8942be01ce3
|
data/README.md
CHANGED
@@ -1,28 +1,49 @@
|
|
1
1
|
# NemWebsocketClient
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
2
|
+
NemWebsocketClientはNEMのWebsocketを扱うためのシンプルなライブラリです。
|
3
|
+
[README_jp.md](README_jp.md)
|
7
4
|
## Installation
|
8
5
|
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
6
|
```ruby
|
12
7
|
gem 'nem_websocket_client'
|
13
8
|
```
|
14
9
|
|
15
|
-
|
10
|
+
## Usage
|
16
11
|
|
17
|
-
|
12
|
+
```ruby
|
13
|
+
require "nem_websocket_client"
|
18
14
|
|
19
|
-
|
15
|
+
host = "http://alice5.nem.ninja"
|
16
|
+
port = 7778
|
17
|
+
ws = NemWebsocketClient::connect(host,port)
|
20
18
|
|
21
|
-
|
19
|
+
ws.connected do
|
20
|
+
p "Connected!"
|
21
|
+
end
|
22
22
|
|
23
|
-
|
23
|
+
ws.subscribe_block do |transaction|
|
24
|
+
transaction["timeStamp"]
|
25
|
+
end
|
26
|
+
|
27
|
+
ws.errors do |e|
|
28
|
+
p e
|
29
|
+
end
|
30
|
+
|
31
|
+
ws.closed do |e|
|
32
|
+
p e
|
33
|
+
end
|
34
|
+
|
35
|
+
loop do
|
36
|
+
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## Test
|
41
|
+
```ruby
|
42
|
+
gem install bundler
|
43
|
+
bundle install
|
44
|
+
rspec
|
45
|
+
```
|
24
46
|
|
25
|
-
TODO: Write usage instructions here
|
26
47
|
|
27
48
|
## Development
|
28
49
|
|
@@ -32,7 +53,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
53
|
|
33
54
|
## Contributing
|
34
55
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/5hyn3/nem_websocket_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
57
|
|
37
58
|
## License
|
38
59
|
|
data/README_jp.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# NemWebsocketClient
|
2
|
+
NemWebsocketClient is a simple library for handling NEM's Websocket
|
3
|
+
[README_jp.md](README_jp.md)
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
gem 'nem_websocket_client'
|
8
|
+
```
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require "nem_websocket_client"
|
14
|
+
|
15
|
+
host = "http://alice5.nem.ninja"
|
16
|
+
port = 7778
|
17
|
+
ws = NemWebsocketClient::connect(host,port)
|
18
|
+
|
19
|
+
ws.connected do
|
20
|
+
p "Connected!"
|
21
|
+
end
|
22
|
+
|
23
|
+
ws.subscribe_block do |transaction|
|
24
|
+
transaction["timeStamp"]
|
25
|
+
end
|
26
|
+
|
27
|
+
ws.errors do |e|
|
28
|
+
p e
|
29
|
+
end
|
30
|
+
|
31
|
+
ws.closed do |e|
|
32
|
+
p e
|
33
|
+
end
|
34
|
+
|
35
|
+
loop do
|
36
|
+
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## Test
|
41
|
+
```ruby
|
42
|
+
gem install bundler
|
43
|
+
bundle install
|
44
|
+
rspec
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
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.
|
51
|
+
|
52
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/5hyn3/nem_websocket_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
61
|
+
|
62
|
+
## Code of Conduct
|
63
|
+
|
64
|
+
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).
|
@@ -39,8 +39,8 @@ module NemWebsocketClient
|
|
39
39
|
@ws.connected_func = fun
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
@ws.
|
42
|
+
def heartbeat(&fun)
|
43
|
+
@ws.heartbeat_func = fun
|
44
44
|
end
|
45
45
|
|
46
46
|
def errors(&fun)
|
@@ -143,7 +143,7 @@ module NemWebsocketClient
|
|
143
143
|
end
|
144
144
|
|
145
145
|
if msg.data[0] == "h"
|
146
|
-
|
146
|
+
heartbeat_func.call unless heartbeat_func.nil?
|
147
147
|
end
|
148
148
|
if msg.data[0] == "a"
|
149
149
|
data = msg.data
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nem_websocket_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shyne
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- Gemfile.lock
|
111
111
|
- LICENSE.txt
|
112
112
|
- README.md
|
113
|
+
- README_jp.md
|
113
114
|
- Rakefile
|
114
115
|
- bin/console
|
115
116
|
- bin/setup
|