Sha256: 79a5660fb13990a416c4dbe8e10e7a2efb403652c481d0fea77b5118471b8e44

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

module Katapaty
  class Configuration
    attr_accessor :username,
      :password,
      :host,
      :port,
      :block_username,
      :block_password,
      :block_host,
      :block_port,
      :ssl

    def counterparty_url
      return 'http://rpc:1234@public.coindaddy.io:14000/api/' unless @host
      "#{protocol}://#{@username}:#{CGI.escape(@password)}@#{@host}:#{@port}/api/"
    end

    def counterblock_url
      return 'http://rpc:1234@public.coindaddy.io:14100/api/' unless @block_host
      authen = ''
      authen = "#{@block_username}:#{CGI.escape(@block_password)}@" if @block_username
      "#{protocol}://#{authen}#{@block_host}:#{@block_port}/api/"
    end

    private

    def protocol
      @ssl ? 'https' : 'http'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katapaty-1.0.6 lib/katapaty/configuration.rb
katapaty-1.0.5 lib/katapaty/configuration.rb
katapaty-1.0.4 lib/katapaty/configuration.rb