Module: Net::Hippie
- Defined in:
- lib/net/hippie.rb,
lib/net/hippie/client.rb,
lib/net/hippie/version.rb,
lib/net/hippie/connection.rb,
lib/net/hippie/content_type_mapper.rb
Overview
Defined Under Namespace
Classes: Client, Connection, ContentTypeMapper
Constant Summary
collapse
- CONNECTION_ERRORS =
[
EOFError,
Errno::ECONNREFUSED,
Errno::ECONNRESET,
Errno::ECONNRESET,
Errno::EHOSTUNREACH,
Errno::EINVAL,
Net::OpenTimeout,
Net::ProtocolError,
Net::ReadTimeout,
OpenSSL::OpenSSLError,
OpenSSL::SSL::SSLError,
SocketError,
Timeout::Error
].freeze
- VERSION =
'1.1.1'
Class Method Summary
collapse
Class Method Details
.basic_auth(username, password) ⇒ Object
49
50
51
|
# File 'lib/net/hippie.rb', line 49
def self.basic_auth(username, password)
"Basic #{::Base64.strict_encode64("#{username}:#{password}")}"
end
|
.bearer_auth(token) ⇒ Object
53
54
55
|
# File 'lib/net/hippie.rb', line 53
def self.bearer_auth(token)
"Bearer #{token}"
end
|
.default_client ⇒ Object
67
68
69
|
# File 'lib/net/hippie.rb', line 67
def self.default_client
@default_client ||= Client.new(follow_redirects: 3, logger: logger)
end
|
.logger ⇒ Object
33
34
35
|
# File 'lib/net/hippie.rb', line 33
def self.logger
@logger ||= Logger.new($stderr)
end
|
.logger=(logger) ⇒ Object
37
38
39
|
# File 'lib/net/hippie.rb', line 37
def self.logger=(logger)
@logger = logger
end
|
.method_missing(symbol, *args) ⇒ Object
57
58
59
60
61
|
# File 'lib/net/hippie.rb', line 57
def self.method_missing(symbol, *args)
default_client.with_retry(retries: 3) do |client|
client.public_send(symbol, *args)
end || super
end
|
.respond_to_missing?(name, _include_private = false) ⇒ Boolean
63
64
65
|
# File 'lib/net/hippie.rb', line 63
def self.respond_to_missing?(name, _include_private = false)
Client.public_instance_methods.include?(name.to_sym) || super
end
|
.verify_mode ⇒ Object
41
42
43
|
# File 'lib/net/hippie.rb', line 41
def self.verify_mode
@verify_mode ||= OpenSSL::SSL::VERIFY_PEER
end
|
.verify_mode=(mode) ⇒ Object
45
46
47
|
# File 'lib/net/hippie.rb', line 45
def self.verify_mode=(mode)
@verify_mode = mode
end
|