bitflyer 2.0.1 → 2.0.3
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/.github/CODEOWNERS +1 -0
- data/.github/dependabot.yml +13 -21
- data/Gemfile.lock +25 -50
- data/README.md +7 -4
- data/bitflyer.gemspec +0 -2
- data/lib/bitflyer/http.rb +43 -27
- data/lib/bitflyer/realtime/client.rb +2 -0
- data/lib/bitflyer/version.rb +1 -1
- metadata +2 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa057685f2e11b3a0bf9f46f0282f240e57e22c4cfbb507e4d92770b8441a997
|
|
4
|
+
data.tar.gz: ae4ce59c0e407b7e80d1970b7f716037fcf5c79e09abee07074b019873fcc5f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 68fb55c3fb2bf4e52595ad2574913b425927f0db1b21d59181163306354d4d2fed6cf0d60213732d36a0cf18e59910e21b00a61311a4d0f8497885777414c5e0
|
|
7
|
+
data.tar.gz: 78819f20b021ffd427837b9525c057fd3f33ef7b9237d274e92fe3089660d8e16255bf2fd70c82d0e2a67a82c22c6aede1e67fb02e1b8b6d15f0578a56549dc2
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @unhappychoice
|
data/.github/dependabot.yml
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
|
-
- package-ecosystem: bundler
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- dependency-name: rubocop
|
|
17
|
-
versions:
|
|
18
|
-
- 1.12.0
|
|
19
|
-
- 1.12.1
|
|
20
|
-
- dependency-name: regexp_parser
|
|
21
|
-
versions:
|
|
22
|
-
- 2.1.0
|
|
23
|
-
- 2.1.1
|
|
3
|
+
- package-ecosystem: bundler
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: daily
|
|
7
|
+
time: "12:00"
|
|
8
|
+
timezone: Asia/Tokyo
|
|
9
|
+
open-pull-requests-limit: 20
|
|
10
|
+
allow:
|
|
11
|
+
- dependency-type: direct
|
|
12
|
+
- dependency-type: indirect
|
|
13
|
+
ignore:
|
|
14
|
+
- dependency-name: parallel
|
|
15
|
+
update-types: ["version-update:semver-major"]
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bitflyer (2.0.
|
|
5
|
-
faraday (>= 1.0)
|
|
6
|
-
faraday_middleware (>= 1.2)
|
|
4
|
+
bitflyer (2.0.3)
|
|
7
5
|
websocket-client-simple (>= 0.9)
|
|
8
6
|
|
|
9
7
|
GEM
|
|
@@ -14,81 +12,58 @@ GEM
|
|
|
14
12
|
coderay (1.1.3)
|
|
15
13
|
diff-lcs (1.6.2)
|
|
16
14
|
event_emitter (0.2.6)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
faraday-excon (~> 1.1)
|
|
21
|
-
faraday-httpclient (~> 1.0)
|
|
22
|
-
faraday-multipart (~> 1.0)
|
|
23
|
-
faraday-net_http (~> 1.0)
|
|
24
|
-
faraday-net_http_persistent (~> 1.0)
|
|
25
|
-
faraday-patron (~> 1.0)
|
|
26
|
-
faraday-rack (~> 1.0)
|
|
27
|
-
faraday-retry (~> 1.0)
|
|
28
|
-
ruby2_keywords (>= 0.0.4)
|
|
29
|
-
faraday-em_http (1.0.0)
|
|
30
|
-
faraday-em_synchrony (1.0.1)
|
|
31
|
-
faraday-excon (1.1.0)
|
|
32
|
-
faraday-httpclient (1.0.1)
|
|
33
|
-
faraday-multipart (1.1.1)
|
|
34
|
-
multipart-post (~> 2.0)
|
|
35
|
-
faraday-net_http (1.0.2)
|
|
36
|
-
faraday-net_http_persistent (1.2.0)
|
|
37
|
-
faraday-patron (1.0.0)
|
|
38
|
-
faraday-rack (1.0.0)
|
|
39
|
-
faraday-retry (1.0.3)
|
|
40
|
-
faraday_middleware (1.2.1)
|
|
41
|
-
faraday (~> 1.0)
|
|
42
|
-
json (2.12.2)
|
|
43
|
-
language_server-protocol (3.17.0.5)
|
|
15
|
+
io-console (0.8.2)
|
|
16
|
+
json (2.21.1)
|
|
17
|
+
language_server-protocol (3.17.0.6)
|
|
44
18
|
lint_roller (1.1.0)
|
|
45
19
|
method_source (1.1.0)
|
|
46
|
-
multipart-post (2.4.1)
|
|
47
20
|
mutex_m (0.3.0)
|
|
48
|
-
parallel (1.
|
|
49
|
-
parser (3.3.
|
|
21
|
+
parallel (1.28.0)
|
|
22
|
+
parser (3.3.12.0)
|
|
50
23
|
ast (~> 2.4.1)
|
|
51
24
|
racc
|
|
52
|
-
prism (1.
|
|
53
|
-
pry (0.
|
|
25
|
+
prism (1.9.0)
|
|
26
|
+
pry (0.16.0)
|
|
54
27
|
coderay (~> 1.1)
|
|
55
28
|
method_source (~> 1.0)
|
|
29
|
+
reline (>= 0.6.0)
|
|
56
30
|
racc (1.8.1)
|
|
57
31
|
rainbow (3.1.1)
|
|
58
|
-
rake (13.
|
|
59
|
-
regexp_parser (2.
|
|
60
|
-
|
|
32
|
+
rake (13.4.2)
|
|
33
|
+
regexp_parser (2.12.0)
|
|
34
|
+
reline (0.6.3)
|
|
35
|
+
io-console (~> 0.5)
|
|
36
|
+
rspec (3.13.2)
|
|
61
37
|
rspec-core (~> 3.13.0)
|
|
62
38
|
rspec-expectations (~> 3.13.0)
|
|
63
39
|
rspec-mocks (~> 3.13.0)
|
|
64
|
-
rspec-core (3.13.
|
|
40
|
+
rspec-core (3.13.6)
|
|
65
41
|
rspec-support (~> 3.13.0)
|
|
66
42
|
rspec-expectations (3.13.5)
|
|
67
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
68
44
|
rspec-support (~> 3.13.0)
|
|
69
|
-
rspec-mocks (3.13.
|
|
45
|
+
rspec-mocks (3.13.8)
|
|
70
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
71
47
|
rspec-support (~> 3.13.0)
|
|
72
|
-
rspec-support (3.13.
|
|
73
|
-
rubocop (1.
|
|
48
|
+
rspec-support (3.13.7)
|
|
49
|
+
rubocop (1.88.2)
|
|
74
50
|
json (~> 2.3)
|
|
75
51
|
language_server-protocol (~> 3.17.0.2)
|
|
76
52
|
lint_roller (~> 1.1.0)
|
|
77
|
-
parallel (
|
|
53
|
+
parallel (>= 1.10)
|
|
78
54
|
parser (>= 3.3.0.2)
|
|
79
55
|
rainbow (>= 2.2.2, < 4.0)
|
|
80
56
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
81
|
-
rubocop-ast (>= 1.
|
|
57
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
82
58
|
ruby-progressbar (~> 1.7)
|
|
83
59
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
84
|
-
rubocop-ast (1.
|
|
60
|
+
rubocop-ast (1.50.0)
|
|
85
61
|
parser (>= 3.3.7.2)
|
|
86
|
-
prism (~> 1.
|
|
62
|
+
prism (~> 1.7)
|
|
87
63
|
ruby-progressbar (1.13.0)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
unicode-emoji (4.0.4)
|
|
64
|
+
unicode-display_width (3.2.0)
|
|
65
|
+
unicode-emoji (~> 4.1)
|
|
66
|
+
unicode-emoji (4.2.0)
|
|
92
67
|
websocket (1.2.11)
|
|
93
68
|
websocket-client-simple (0.9.0)
|
|
94
69
|
base64
|
data/README.md
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
[](#contributors-)
|
|
4
4
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
5
5
|
[](https://badge.fury.io/rb/bitflyer)
|
|
6
|
-
[](https://libraries.io/github/unhappychoice/bitflyer)
|
|
6
|
+
[](https://codeclimate.com/github/bitflyer-tools/bitflyer)
|
|
7
|
+
[](https://libraries.io/github/bitflyer-tools/bitflyer)
|
|
9
8
|

|
|
10
|
-

|
|
11
10
|
|
|
12
11
|
bitflyer is a wrapper interface of [Bitflyer lightning API](https://lightning.bitflyer.jp/docs)
|
|
13
12
|
|
|
@@ -115,3 +114,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
115
114
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
116
115
|
|
|
117
116
|
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
117
|
+
|
|
118
|
+
## Author
|
|
119
|
+
|
|
120
|
+
[@unhappychoice](https://unhappychoice.com)
|
data/bitflyer.gemspec
CHANGED
|
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
19
|
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
-
spec.add_dependency 'faraday', '>= 1.0'
|
|
22
|
-
spec.add_dependency 'faraday_middleware', '>= 1.2'
|
|
23
21
|
spec.add_dependency 'websocket-client-simple', '>= 0.9'
|
|
24
22
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
25
23
|
spec.add_development_dependency 'pry'
|
data/lib/bitflyer/http.rb
CHANGED
|
@@ -3,46 +3,62 @@
|
|
|
3
3
|
require 'bitflyer'
|
|
4
4
|
require 'bitflyer/http/public'
|
|
5
5
|
require 'bitflyer/http/private'
|
|
6
|
-
require '
|
|
7
|
-
require '
|
|
6
|
+
require 'net/http'
|
|
7
|
+
require 'uri'
|
|
8
|
+
require 'json'
|
|
8
9
|
require 'openssl'
|
|
9
10
|
|
|
10
11
|
module Bitflyer
|
|
11
12
|
module HTTP
|
|
12
|
-
|
|
13
|
-
extend Forwardable
|
|
13
|
+
BASE_URL = 'https://api.bitflyer.jp'
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Response = Struct.new(:body)
|
|
16
16
|
|
|
17
|
+
class Connection
|
|
17
18
|
def initialize(key, secret)
|
|
18
|
-
@connection = Faraday::Connection.new(url: 'https://api.bitflyer.jp') do |f|
|
|
19
|
-
f.request :json
|
|
20
|
-
f.response :json
|
|
21
|
-
f.use Authentication, key, secret
|
|
22
|
-
f.adapter Faraday.default_adapter
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
class Authentication < Faraday::Middleware
|
|
28
|
-
def initialize(app, key, secret)
|
|
29
|
-
super(app)
|
|
30
19
|
@key = key
|
|
31
20
|
@secret = secret
|
|
21
|
+
@uri = URI.parse(BASE_URL)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def get(path, params = {})
|
|
25
|
+
query = URI.encode_www_form(params.compact)
|
|
26
|
+
full_path = query.empty? ? path : "#{path}?#{query}"
|
|
27
|
+
request = Net::HTTP::Get.new(full_path, default_headers)
|
|
28
|
+
sign_request(request, full_path)
|
|
29
|
+
Response.new(execute(request))
|
|
32
30
|
end
|
|
33
31
|
|
|
34
|
-
def
|
|
35
|
-
|
|
32
|
+
def post(path, body = {})
|
|
33
|
+
request = Net::HTTP::Post.new(path, default_headers.merge('Content-Type' => 'application/json'))
|
|
34
|
+
request.body = JSON.generate(body.compact)
|
|
35
|
+
sign_request(request, path, request.body)
|
|
36
|
+
Response.new(execute(request))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def default_headers
|
|
42
|
+
{ 'Accept' => 'application/json' }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def sign_request(request, path, body = '')
|
|
46
|
+
return if @key.nil? || @secret.nil?
|
|
36
47
|
|
|
37
48
|
timestamp = Time.now.to_i.to_s
|
|
38
|
-
method =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
method = request.method.upcase
|
|
50
|
+
text = timestamp + method + path + (body || '')
|
|
51
|
+
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), @secret, text)
|
|
52
|
+
request['ACCESS-KEY'] = @key
|
|
53
|
+
request['ACCESS-TIMESTAMP'] = timestamp
|
|
54
|
+
request['ACCESS-SIGN'] = signature
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def execute(request)
|
|
58
|
+
response = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) { |http| http.request(request) }
|
|
59
|
+
JSON.parse(response.body)
|
|
60
|
+
rescue JSON::ParserError
|
|
61
|
+
response.body
|
|
46
62
|
end
|
|
47
63
|
end
|
|
48
64
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'forwardable'
|
|
3
4
|
require_relative 'websocket'
|
|
4
5
|
|
|
5
6
|
module Bitflyer
|
|
@@ -15,6 +16,7 @@ module Bitflyer
|
|
|
15
16
|
|
|
16
17
|
class Client
|
|
17
18
|
extend Forwardable
|
|
19
|
+
|
|
18
20
|
def_delegators :@websocket_client, :ready=, :disconnected=
|
|
19
21
|
attr_accessor :websocket_client, :ping_interval, :ping_timeout, :last_ping_at, :last_pong_at
|
|
20
22
|
|
data/lib/bitflyer/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bitflyer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuji Ueki
|
|
@@ -9,34 +9,6 @@ bindir: exe
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: faraday
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '1.0'
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - ">="
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '1.0'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: faraday_middleware
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '1.2'
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.2'
|
|
40
12
|
- !ruby/object:Gem::Dependency
|
|
41
13
|
name: websocket-client-simple
|
|
42
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -129,6 +101,7 @@ extensions: []
|
|
|
129
101
|
extra_rdoc_files: []
|
|
130
102
|
files:
|
|
131
103
|
- ".all-contributorsrc"
|
|
104
|
+
- ".github/CODEOWNERS"
|
|
132
105
|
- ".github/dependabot.yml"
|
|
133
106
|
- ".github/workflows/release.yaml"
|
|
134
107
|
- ".github/workflows/test.yml"
|