Sha256: fed0a5e9b9e8a5690d8c24f93a90e899f51386b1c8daba7acfe4c425a9b759b5

Contents?: true

Size: 558 Bytes

Versions: 9

Compression:

Stored size: 558 Bytes

Contents

module Twurl
  class RequestController < AbstractCommandController
    NO_URI_MESSAGE = "No URI specified"
    def dispatch
      if client.needs_to_authorize?
        raise Exception, "You need to authorize first."
      end
      options.path ||= OAuthClient.rcfile.alias_from_options(options)
      perform_request
    end

    def perform_request
      client.perform_request_from_options(options) { |response|
        response.read_body { |chunk| CLI.print chunk }
      }
    rescue URI::InvalidURIError
      CLI.puts NO_URI_MESSAGE
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
twurl-0.9.3 lib/twurl/request_controller.rb
twurl-0.9.2 lib/twurl/request_controller.rb
twurl-0.9.1 lib/twurl/request_controller.rb
twurl-0.9.0 lib/twurl/request_controller.rb
twurl-0.8.3 lib/twurl/request_controller.rb
twurl-0.8.2 lib/twurl/request_controller.rb
twurl-0.8.1 lib/twurl/request_controller.rb
twurl-0.8.0 lib/twurl/request_controller.rb
twurl-0.7.0 lib/twurl/request_controller.rb