mixin_bot 0.1.3 → 0.1.4
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/lib/mixin_bot.rb +1 -1
- data/lib/mixin_bot/api.rb +3 -2
- data/lib/mixin_bot/api/blaze.rb +3 -3
- data/lib/mixin_bot/client.rb +7 -2
- data/lib/mixin_bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d5375d1baf6a03ec32d4e32ee415917e439780e6361473497a57f12ad2df248
|
4
|
+
data.tar.gz: 5d03c3a70cccdc5a12b589f4b8697e6b408107af79884949a2b645ef942ca71e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a4ff89a2d885624fe21c077137688593cd605791e8930c9cfe3926ed2f2b50607e4cd4cf992f5d1490e6ce430ab0d82606973a2504d3f12f9f4cf7d51e942c1
|
7
|
+
data.tar.gz: a90fa0d4e3d1f50e0a40a01b9da057061789226cb988c1a3fbb73c9e74c979fe70ce34ff03ec489de984883e798d29e87d8d58ccee3c398bb05bc24c7a9a4eaa
|
data/lib/mixin_bot.rb
CHANGED
@@ -10,7 +10,7 @@ require_relative './mixin_bot/api'
|
|
10
10
|
|
11
11
|
module MixinBot
|
12
12
|
class<< self
|
13
|
-
attr_accessor :client_id, :client_secret, :session_id, :pin_token, :private_key, :scope
|
13
|
+
attr_accessor :client_id, :client_secret, :session_id, :pin_token, :private_key, :scope, :api_host, :blaze_host
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.api
|
data/lib/mixin_bot/api.rb
CHANGED
@@ -18,7 +18,7 @@ require_relative './api/withdraw'
|
|
18
18
|
module MixinBot
|
19
19
|
class API
|
20
20
|
attr_reader :client_id, :client_secret, :session_id, :pin_token, :private_key
|
21
|
-
attr_reader :client
|
21
|
+
attr_reader :client, :blaze_host
|
22
22
|
|
23
23
|
def initialize(options = {})
|
24
24
|
@client_id = options[:client_id] || MixinBot.client_id
|
@@ -26,7 +26,8 @@ module MixinBot
|
|
26
26
|
@session_id = options[:session_id] || MixinBot.session_id
|
27
27
|
@pin_token = Base64.decode64 options[:pin_token] || MixinBot.pin_token
|
28
28
|
@private_key = OpenSSL::PKey::RSA.new options[:private_key] || MixinBot.private_key
|
29
|
-
@client = Client.new
|
29
|
+
@client = Client.new(MixinBot.api_host)
|
30
|
+
@blaze_host = MixinBot.blaze_host || 'blaze.mixin.one'
|
30
31
|
end
|
31
32
|
|
32
33
|
include MixinBot::API::Attachment
|
data/lib/mixin_bot/api/blaze.rb
CHANGED
@@ -7,14 +7,14 @@ module MixinBot
|
|
7
7
|
access_token = access_token('GET', '/', '')
|
8
8
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
9
9
|
Faye::WebSocket::Client.new(
|
10
|
-
'wss
|
10
|
+
format('wss://%<host>s/', host: blaze_host),
|
11
11
|
['Mixin-Blaze-1'],
|
12
12
|
headers: { 'Authorization' => authorization },
|
13
13
|
ping: 60
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def start_blaze_connect(reconnect = true, &_block)
|
18
18
|
ws ||= blaze
|
19
19
|
yield if block_given?
|
20
20
|
|
@@ -54,7 +54,7 @@ module MixinBot
|
|
54
54
|
end
|
55
55
|
|
56
56
|
ws = nil
|
57
|
-
|
57
|
+
start_blaze_connect { yield } if reconnect
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/lib/mixin_bot/client.rb
CHANGED
@@ -3,7 +3,12 @@
|
|
3
3
|
module MixinBot
|
4
4
|
class Client
|
5
5
|
SERVER_SCHEME = 'https'
|
6
|
-
|
6
|
+
|
7
|
+
attr_reader :host
|
8
|
+
|
9
|
+
def initialize(host = 'api.mixin.one')
|
10
|
+
@host = host
|
11
|
+
end
|
7
12
|
|
8
13
|
def get(path, options = {})
|
9
14
|
request(:get, path, options)
|
@@ -44,7 +49,7 @@ module MixinBot
|
|
44
49
|
def uri_for(path)
|
45
50
|
uri_options = {
|
46
51
|
scheme: SERVER_SCHEME,
|
47
|
-
host:
|
52
|
+
host: host,
|
48
53
|
path: path
|
49
54
|
}
|
50
55
|
Addressable::URI.new(uri_options)
|
data/lib/mixin_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixin_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|