Sha256: 36fe97f121c09d1c6f9c32c3a53d080361aae58e86fb1bfdfd80029e5c1a11b8

Contents?: true

Size: 448 Bytes

Versions: 2

Compression:

Stored size: 448 Bytes

Contents

require 'horseman/response'

module Horseman
  class Action
    attr_reader :uri, :response
    
    def initialize(uri, response=nil)
      @uri = uri
      @response = Horseman::Response.new(response.body, response.to_hash) unless response.nil?
    end
    
    def url
      "#{@uri.scheme}://#{@uri.host}#{@uri.path}" + (@uri.query ? "?#{@uri.query}" : "")
    end
    
    def relative_root
      "#{url.rpartition('/')[0]}/"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
horseman-0.0.4 lib/horseman/action.rb
horseman-0.0.3 lib/horseman/action.rb