Extract and parse options used to download a file or resource from an HTTP API
 @param options [Hash]
 @return [Hash]
485719
def extract_download_options(options)
        url = options.fetch('url')

        # This avoids the potential for a KeyError
        headers = options.fetch('headers', {}) || {}

        file_size_value = options.fetch('file_size', 0)
        file_size = file_size_value.to_i

        output = {
          url: ::Addressable::URI.parse(url),
          headers: headers,
          file_size: file_size
        }

        output[:file_size] = get_file_size(output) if output[:file_size] < 1
        output
      end
479343
def options
      {
        headers: {
          accept: :json,
          content_type: :json,
          accept_encoding: 'gzip ,deflate',
          user_agent: "FreshdeskAPI API #{FreshdeskAPI::VERSION}"
        },
        read_timeout: nil,
        open_timeout: nil,
        base_url: @base_url
      }.merge(client_options)
    end
594984
def parse_options
      super do |opts|

        opts.on("-u", "--unmodified [MODE]", "Show unmodified repos.  MODE=SHOW (default), DOTS, or HIDE") do |u|
          options[:unmodified] = u || "SHOW"
          options[:unmodified].upcase!
        end

        opts.on("--short", "Summary status only, do not show individual file status") do |s|
          options[:short] = s
        end

      end
    end
1289307
def _process_options(options)
        status, content_type, location = options.values_at(:status, :content_type, :location)

        self.status = status if status
        self.content_type = content_type if content_type
        headers["Location"] = url_for(location) if location

        super
      end
999523
def parse_options(options, arg_split:':', valuesep: '=', opt_default: true, keyed_sep: "/")
			return {} unless options
			parsed_options={}
			options=options.split(arg_split) unless options.is_a?(Enumerable)
			options.each do |optvalue|
				opt,value=DR::SimpleParser.parse_namevalue(optvalue,sep: valuesep, default: opt_default)
				parsed_options.set_keyed_value(opt,value, sep: keyed_sep)
			end
			return parsed_options
		end
410977
def get(url, options = {})
      connection(url, options) do |uri, conn|
        conn.get(uri.request_uri, options)
      end
    end
328991
def extract_options(args)
      options = args.last
      options.respond_to?(:to_hash) ? options.to_hash.dup : {}
    end
68858
def extract_environment!(options)
      values = []
      [:environment, :env, :rubies, :ruby].each do |k|
        values << options.delete(k)
      end
      values.compact.first
    end
450493
def parse_options(options)
      options = Shellwords.split(options) unless options.is_a?(Array)
      parser = Thor::Options.new(self.class.class_options)
      parser.parse(options)
    end
55316
def _extract_options
      environment.to_options.merge(
        config:      rackup,
        Host:        environment.host,
        Port:        environment.port,
        AccessLog:   []
      )
    end
24780
def get(path, options={}, format=format)
      respond request(:get, path, options, format)
    end
120179
def extract_options!(array)
      if array.last.is_a?(Hash) && array.last.instance_of?(Hash)
        array.pop
      else
        {}
      end
    end
12638
def fetch_rails_source(file, options = {})
        # use Rails template resolution mechanism if possible (find_template)
        source_format = request_format if defined?(request_format)

        if source_format && context_scope.respond_to?(:lookup_context) # Rails 3
          lookup_proc = lambda do |partial|
            if ActionPack::VERSION::MAJOR == 3 && ActionPack::VERSION::MINOR < 2
              context_scope.lookup_context.find(file, [], partial)
            else # Rails 3.2 and higher
              # pull format directly from rails unless it is html
              request_format = context_scope.request.format.to_sym
              source_format = request_format unless request_format == :html
              context_scope.lookup_context.find(file, [], partial, [], { :formats => [source_format] })
            end
          end
          template = lookup_proc.call(false) rescue nil
          template ||= lookup_proc.call(true) rescue nil
          template.identifier if template
        elsif source_format && context_scope.respond_to?(:view_paths) # Rails 2
          template = context_scope.view_paths.find_template(file, source_format, false)
          template.filename if template
        end
      end
179358
def download(url, options = {})
      options = @options.merge(options)

      max_size            = options.delete(:max_size)
      max_redirects       = options.delete(:max_redirects)
      progress_proc       = options.delete(:progress_proc)
      content_length_proc = options.delete(:content_length_proc)
      destination         = options.delete(:destination)
      headers             = options.delete(:headers) || {}

      # Use open-uri's :content_lenth_proc or :progress_proc to raise an
      # exception early if the file is too large.
      #
      # Also disable following redirects, as we'll provide our own
      # implementation that has the ability to limit the number of redirects.
      open_uri_options = {
        content_length_proc: proc { |size|
          if size && max_size && size > max_size
            raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
          end
          content_length_proc.call(size) if content_length_proc
        },
        progress_proc: proc { |current_size|
          if max_size && current_size > max_size
            raise Down::TooLarge, "file is too large (max is #{max_size/1024/1024}MB)"
          end
          progress_proc.call(current_size) if progress_proc
        },
        redirect: false,
      }

      # Handle basic authentication in the :proxy option.
      if options[:proxy]
        proxy    = URI(options.delete(:proxy))
        user     = proxy.user
        password = proxy.password

        if user || password
          proxy.user     = nil
          proxy.password = nil

          open_uri_options[:proxy_http_basic_authentication] = [proxy.to_s, user, password]
        else
          open_uri_options[:proxy] = proxy.to_s
        end
      end

      open_uri_options.merge!(options)
      open_uri_options.merge!(headers)

      uri = ensure_uri(addressable_normalize(url))

      # Handle basic authentication in the remote URL.
      if uri.user || uri.password
        open_uri_options[:http_basic_authentication] ||= [uri.user, uri.password]
        uri.user = nil
        uri.password = nil
      end

      open_uri_file = open_uri(uri, open_uri_options, follows_remaining: max_redirects)

      # Handle the fact that open-uri returns StringIOs for small files.
      tempfile = ensure_tempfile(open_uri_file, File.extname(open_uri_file.base_uri.path))
      OpenURI::Meta.init tempfile, open_uri_file # add back open-uri methods
      tempfile.extend Down::NetHttp::DownloadedFile

      download_result(tempfile, destination)
    end
563607
def get(uri)
      uri = Resync::XML.to_uri(uri)
      @helper.fetch(uri: uri)
    end
308041
def get_api_results(url)
      uri = URI.parse(url)
      puts "URL: #{url}" if self.verbose
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true

      request = Net::HTTP::Get.new(uri.request_uri)
      response = http.request(request)

      JSON.parse(response.body)
    end
459008
def parse_options(cls, options):
        
        options = options.copy()
        subdomain = options.pop('subdomain', None)
        endpoint = options.pop('endpoint', None)
        return subdomain, endpoint, options,