Sha256: 830e3de1a7d2bc12951fab3fec65f6e884077b79c4a1dc4193dccaaa5827353b

Contents?: true

Size: 583 Bytes

Versions: 20

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true
require 'addressable/uri'
require 'proxy_rb/credentials'

# ProxyRb
module ProxyRb
  # A resource
  class Resource
    attr_accessor :content
    attr_reader :credentials, :url

    def initialize(url)
      @url = Addressable::URI.parse(url)
    end

    # Return credentials from url
    #
    # @return [Credentials]
    #   The credentials from url
    def credentials
      Credentials.new(url.user, url.password)
    end

    # Convert resource to url
    #
    # @return [String] url
    #   The url
    def to_s
      url.to_s
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
proxy_rb-1.0.0 lib/proxy_rb/resource.rb
proxy_rb-0.10.6 lib/proxy_rb/resource.rb
proxy_rb-0.10.5 lib/proxy_rb/resource.rb
proxy_rb-0.10.4 lib/proxy_rb/resource.rb
proxy_rb-0.10.3 lib/proxy_rb/resource.rb
proxy_rb-0.10.2 lib/proxy_rb/resource.rb
proxy_rb-0.10.1 lib/proxy_rb/resource.rb
proxy_rb-0.10.0 lib/proxy_rb/resource.rb
proxy_rb-0.9.3 lib/proxy_rb/resource.rb
proxy_rb-0.9.2 lib/proxy_rb/resource.rb
proxy_rb-0.9.1 lib/proxy_rb/resource.rb
proxy_rb-0.9.0 lib/proxy_rb/resource.rb
proxy_rb-0.8.3 lib/proxy_rb/resource.rb
proxy_rb-0.8.2 lib/proxy_rb/resource.rb
proxy_rb-0.8.1 lib/proxy_rb/resource.rb
proxy_rb-0.8.0 lib/proxy_rb/resource.rb
proxy_rb-0.7.1 lib/proxy_rb/resource.rb
proxy_rb-0.7.0 lib/proxy_rb/resource.rb
proxy_rb-0.6.0 lib/proxy_rb/resource.rb
proxy_rb-0.5.0 lib/proxy_rb/resource.rb