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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d35e63d1229361b23be1356cd0d341662c5e33838dd0ba3f37afacd182c61dd4
4
- data.tar.gz: b737b9d7ad6544ab5271433a920a0c37fdef126a9d0d6e2c730d65b9b40a4c6a
3
+ metadata.gz: 8d5375d1baf6a03ec32d4e32ee415917e439780e6361473497a57f12ad2df248
4
+ data.tar.gz: 5d03c3a70cccdc5a12b589f4b8697e6b408107af79884949a2b645ef942ca71e
5
5
  SHA512:
6
- metadata.gz: 5993dfafb5b91bdcf5b568f5458f51ce46911be312af5a3faa3fba221b073e3acfea037f5bd403eab952fc9790dd420d712a2321ec48583d5dd9a2b4a3ec657e
7
- data.tar.gz: ebda3aeac025cf3e27840e6ac082cce436d87292ec22efd23aea7667c89c5b7e84ac83107125ff828df586c397f4511d8285cdd2cf0acf527d6ac2c2f1779448
6
+ metadata.gz: 5a4ff89a2d885624fe21c077137688593cd605791e8930c9cfe3926ed2f2b50607e4cd4cf992f5d1490e6ce430ab0d82606973a2504d3f12f9f4cf7d51e942c1
7
+ data.tar.gz: a90fa0d4e3d1f50e0a40a01b9da057061789226cb988c1a3fbb73c9e74c979fe70ce34ff03ec489de984883e798d29e87d8d58ccee3c398bb05bc24c7a9a4eaa
@@ -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
@@ -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
@@ -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://blaze.mixin.one/',
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 start_blaze_connnect(reconnect = true, &_block)
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
- start_blaze_connnect { yield } if reconnect
57
+ start_blaze_connect { yield } if reconnect
58
58
  end
59
59
  end
60
60
  end
@@ -3,7 +3,12 @@
3
3
  module MixinBot
4
4
  class Client
5
5
  SERVER_SCHEME = 'https'
6
- SERVER_HOST = 'api.mixin.one'
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: SERVER_HOST,
52
+ host: host,
48
53
  path: path
49
54
  }
50
55
  Addressable::URI.new(uri_options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MixinBot
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
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.3
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-10-30 00:00:00.000000000 Z
11
+ date: 2019-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt