Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native api fix rdebug recursion alt #1205

Merged
merged 5 commits into from Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions faraday.gemspec
@@ -1,13 +1,10 @@
# frozen_string_literal: true

lib = 'faraday'
lib_file = File.expand_path("../lib/#{lib}.rb", __FILE__)
File.read(lib_file) =~ /\bVERSION\s*=\s*["'](.+?)["']/
version = Regexp.last_match(1)
require_relative 'lib/faraday/version'

Gem::Specification.new do |spec|
spec.name = lib
spec.version = version
spec.name = 'faraday'
spec.version = Faraday::VERSION

spec.summary = 'HTTP/REST API client library.'

Expand Down
89 changes: 48 additions & 41 deletions lib/faraday.rb
Expand Up @@ -6,6 +6,26 @@
require 'faraday/middleware_registry'
require 'faraday/dependency_loader'

unless defined?(::Faraday::Timer)
require 'timeout'
Timer = Timeout
end

require 'faraday/version'
require 'faraday/methods'
require 'faraday/utils'
require 'faraday/options'
require 'faraday/connection'
require 'faraday/rack_builder'
require 'faraday/parameters'
require 'faraday/middleware'
require 'faraday/adapter'
require 'faraday/request'
require 'faraday/response'
require 'faraday/error'
require 'faraday/file_part'
require 'faraday/param_part'

# This is the main namespace for Faraday.
#
# It provides methods to create {Connection} objects, and HTTP-related
Expand All @@ -19,10 +39,6 @@
# conn.get '/'
#
module Faraday
VERSION = '1.1.0'
METHODS_WITH_QUERY = %w[get head delete trace].freeze
METHODS_WITH_BODY = %w[post put patch].freeze

class << self
# The root path that Faraday is being loaded from.
#
Expand Down Expand Up @@ -107,6 +123,34 @@ def respond_to_missing?(symbol, include_private = false)
default_connection.respond_to?(symbol, include_private) || super
end

# @overload default_connection
# Gets the default connection used for simple scripts.
# @return [Faraday::Connection] a connection configured with
# the default_adapter.
# @overload default_connection=(connection)
# @param connection [Faraday::Connection]
# Sets the default {Faraday::Connection} for simple scripts that
# access the Faraday constant directly, such as
# <code>Faraday.get "https://faraday.com"</code>.
def default_connection
@default_connection ||= Connection.new(default_connection_options)
end

# Gets the default connection options used when calling {Faraday#new}.
#
# @return [Faraday::ConnectionOptions]
def default_connection_options
@default_connection_options ||= ConnectionOptions.new
end

# Sets the default options used when calling {Faraday#new}.
#
# @param options [Hash, Faraday::ConnectionOptions]
def default_connection_options=(options)
@default_connection = nil
@default_connection_options = ConnectionOptions.from(options)
end

private

# Internal: Proxies method calls on the Faraday constant to
Expand All @@ -125,42 +169,5 @@ def method_missing(name, *args, &block)
self.lib_path = File.expand_path 'faraday', __dir__
self.default_adapter = :net_http

# @overload default_connection
# Gets the default connection used for simple scripts.
# @return [Faraday::Connection] a connection configured with
# the default_adapter.
# @overload default_connection=(connection)
# @param connection [Faraday::Connection]
# Sets the default {Faraday::Connection} for simple scripts that
# access the Faraday constant directly, such as
# <code>Faraday.get "https://faraday.com"</code>.
def self.default_connection
@default_connection ||= Connection.new(default_connection_options)
end

# Gets the default connection options used when calling {Faraday#new}.
#
# @return [Faraday::ConnectionOptions]
def self.default_connection_options
@default_connection_options ||= ConnectionOptions.new
end

# Sets the default options used when calling {Faraday#new}.
#
# @param options [Hash, Faraday::ConnectionOptions]
def self.default_connection_options=(options)
@default_connection = nil
@default_connection_options = ConnectionOptions.from(options)
end

unless defined?(::Faraday::Timer)
require 'timeout'
Timer = Timeout
end

require_libs 'utils', 'options', 'connection', 'rack_builder', 'parameters',
'middleware', 'adapter', 'request', 'response', 'error',
'file_part', 'param_part'

require_lib 'autoload' unless ENV['FARADAY_NO_AUTOLOAD']
end
6 changes: 6 additions & 0 deletions lib/faraday/methods.rb
@@ -0,0 +1,6 @@
# frozen_string_literal: true

module Faraday
METHODS_WITH_QUERY = %w[get head delete trace].freeze
METHODS_WITH_BODY = %w[post put patch].freeze
end
5 changes: 5 additions & 0 deletions lib/faraday/version.rb
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module Faraday
VERSION = '1.1.0'
end