Sha256: 197a65672e0450e7f26105ee8bd260e4bcdd6999b98fb9cc9d70d1f704024f27

Contents?: true

Size: 1.46 KB

Versions: 12

Compression:

Stored size: 1.46 KB

Contents

module Peatio
  module Bitgo
    module Hooks
      BLOCKCHAIN_VERSION_REQUIREMENT = "~> 1.0.0"
      WALLET_VERSION_REQUIREMENT = "~> 1.0.0"

      class << self
        def check_compatibility
          unless Gem::Requirement.new(BLOCKCHAIN_VERSION_REQUIREMENT)
                                 .satisfied_by?(Gem::Version.new(Peatio::Blockchain::VERSION))
            [
              "Bitgo blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
              "Bitgo blockchain requires #{BLOCKCHAIN_VERSION_REQUIREMENT}.",
              "Peatio::Blockchain version is #{Peatio::Blockchain::VERSION}"
            ].join('\n').tap { |s| Kernel.abort s }
          end

          unless Gem::Requirement.new(WALLET_VERSION_REQUIREMENT)
                                 .satisfied_by?(Gem::Version.new(Peatio::Wallet::VERSION))
            [
              "Bitgo wallet version requiremnt was not suttisfied by Peatio::Wallet.",
              "Bitgo wallet requires #{WALLET_VERSION_REQUIREMENT}.",
              "Peatio::Wallet version is #{Peatio::Wallet::VERSION}"
            ].join('\n').tap { |s| Kernel.abort s }
          end
        end

        def register
          Peatio::Blockchain.registry[:bitgo] = Bitgo::Blockchain
          Peatio::Wallet.registry[:bitgo] = Bitgo::Wallet
        end
      end

      if defined?(Rails::Railtie)
        require "peatio/bitgo/railtie"
      else
        check_compatibility
        register
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
peatio-bitgo-2.5.2 lib/peatio/bitgo/hooks.rb
peatio-bitgo-jruby-2.5.1 lib/peatio/bitgo/hooks.rb
peatio-bitgo-2.5.1 lib/peatio/bitgo/hooks.rb
peatio-bitgo-2.5.0 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.6 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.5 lib/peatio/bitgo/hooks.rb
peatio-bitgo-2.6.0 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.4 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.3 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.2 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.1 lib/peatio/bitgo/hooks.rb
peatio-bitgo-1.1.0 lib/peatio/bitgo/hooks.rb