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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85b5c4757dbaad89b2026eb02a968ce8144600c3
4
- data.tar.gz: 14b3ca89cf00d534ec80ee7ccbf07b417e5f40bf
3
+ metadata.gz: 000c7c676c886dbfc5adc6ccfe6bee6810f37549
4
+ data.tar.gz: f40f37a9f9e910f7b267efdea81b9c85fd5b2f74
5
5
  SHA512:
6
- metadata.gz: aec24e34af924ca9b4f35403933adece0761afc9473218520cac79d04bbdc1471e0a39ad0a34b3f7ec87cbf20b7ebc6f0a3ea2cc4cbcce9fae43bae994b1eeca
7
- data.tar.gz: c4f2773d921a5209437d2a29ceecde54dbef330e75b3af673383e749b93e1cebb305fae321107b31cbcd95ab38e237a88fe58c618e53bae1a4d454efb2f06e70
6
+ metadata.gz: c7e7384ac4d1451f0b9249ecbf2e9ef8fee18498a032554ce73c2903e4b9027a4766e35c2e1f56edc1222a75b80f565321ab6a47f1efe208328a9eff824f2f37
7
+ data.tar.gz: 18a8940b2ca1ba40889de3476cbf2e9284ffd7b25eceb0aa89996ee6a67c60357b124d2f2d34dddba0865027b2fea3d2f8df3dff02ffbdce5e82d8942be01ce3
data/README.md CHANGED
@@ -1,28 +1,49 @@
1
1
  # NemWebsocketClient
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nem_websocket_client`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- And then execute:
10
+ ## Usage
16
11
 
17
- $ bundle
12
+ ```ruby
13
+ require "nem_websocket_client"
18
14
 
19
- Or install it yourself as:
15
+ host = "http://alice5.nem.ninja"
16
+ port = 7778
17
+ ws = NemWebsocketClient::connect(host,port)
20
18
 
21
- $ gem install nem_websocket_client
19
+ ws.connected do
20
+ p "Connected!"
21
+ end
22
22
 
23
- ## Usage
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/[USERNAME]/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.
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 heatbeat(&fun)
43
- @ws.heatbeat_func = fun
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
- heatbeat_func.call
146
+ heartbeat_func.call unless heartbeat_func.nil?
147
147
  end
148
148
  if msg.data[0] == "a"
149
149
  data = msg.data
@@ -1,3 +1,3 @@
1
1
  module NemWebsocketClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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