Sha256: b5a00f300a63e10c9bbfbe291d1be8d3f5dea8f84c13e8a85832a76a51556b0b

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

require "ribose/response/raise_error"

module Ribose
  class Configuration
    attr_accessor :api_host, :api_email, :api_token,
                  :user_email, :user_password,
                  :verify_ssl,
                  :debug_mode

    def initialize
      @debug_mode = false
      @verify_ssl = true
      @api_host ||= "https://www.ribose.com"
    end

    def debug_mode?
      debug_mode == true
    end

    def verify_ssl?
      !!verify_ssl
    end

    def ssl_verification_mode
      verify_ssl? ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
    end

    def add_default_middleware(builder)
      builder.use(Ribose::Response::RaiseError)
      builder.response(:logger, nil, bodies: true) if debug_mode?
      builder.adapter(Faraday.default_adapter)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ribose-0.4.1 lib/ribose/configuration.rb