code
stringlengths
26
124k
docstring
stringlengths
23
125k
func_name
stringlengths
1
98
language
stringclasses
1 value
repo
stringlengths
5
53
path
stringlengths
7
151
url
stringlengths
50
211
license
stringclasses
7 values
def stubbed_from(value) @from = value self end
Set from value to mark an expectaion. Useful for other libraries, e.g. WebMock. @example Mark expectation. expectation.from(:webmock) @param [ String ] value Value to set. @return [ Expectation ] Returns self. @api private
stubbed_from
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def and_return(response=nil, &block) new_response = (response.nil? ? block : response) responses.push(*new_response) end
Specify what should be returned, when this expectation is hit. @example Add response. expectation.and_return(response) @return [ void ]
and_return
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def matches?(request) url_match?(request.base_url) && options_match?(request) end
Checks whether this expectation matches the provided request. @example Check if request matches. expectation.matches? request @param [ Request ] request The request to check. @return [ Boolean ] True when matches, else false. @api private
matches?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def responses @responses ||= [] end
Return canned responses. @example Return responses. expectation.responses @return [ Array<Typhoeus::Response> ] The responses. @api private
responses
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def response(request) response = responses.fetch(@response_counter, responses.last) if response.respond_to?(:call) response = response.call(request) end @response_counter += 1 response.mock = @from || true response end
Return the response. When there are multiple responses, they are returned one by one. @example Return response. expectation.response @return [ Response ] The response. @api private
response
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def options_match?(request) (options ? options.all?{ |k,v| request.original_options[k] == v || request.options[k] == v } : true) end
Check whether the options matches the request options. I checks options and original options.
options_match?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def url_match?(request_url) case base_url when String base_url == request_url when Regexp base_url === request_url when nil true else false end end
Check whether the base_url matches the request url. The base_url can be a string, regex or nil. String and regexp are checked, nil is always true, else false. Nil serves as a placeholder in case you want to match all urls.
url_match?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/expectation.rb
Apache-2.0
def hydra Thread.current[:typhoeus_hydra] ||= new end
Returns a memoized hydra instance. @example Get a hydra. Typhoeus::Hydra.hydra @return [Typhoeus::Hydra] A new hydra.
hydra
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra.rb
Apache-2.0
def initialize(options = {}) @options = options @max_concurrency = Integer(@options.fetch(:max_concurrency, 200)) @multi = Ethon::Multi.new(options.reject{|k,_| k==:max_concurrency}) end
Create a new hydra. All {http://rubydoc.info/github/typhoeus/ethon/Ethon/Multi#initialize-instance_method Ethon::Multi#initialize} options are also available. @example Create a hydra. Typhoeus::Hydra.new @example Create a hydra with max_concurrency. Typhoeus::Hydra.new(max_concurrency: 20) @param [ Hash ] options The options hash. @option options :max_concurrency [ Integer ] Number of max concurrent connections to create. Default is 200. @see http://rubydoc.info/github/typhoeus/ethon/Ethon/Multi#initialize-instance_method Ethon::Multi#initialize
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra.rb
Apache-2.0
def initialize(base_url, options = {}) @base_url = base_url @original_options = options @options = options.dup set_defaults end
Creates a new request. @example Simplest request. response = Typhoeus::Request.new("www.example.com").run @example Request with url parameters. response = Typhoeus::Request.new( "www.example.com", params: {a: 1} ).run @example Request with a body. response = Typhoeus::Request.new( "www.example.com", body: {b: 2} ).run @example Request with parameters and body. response = Typhoeus::Request.new( "www.example.com", params: {a: 1}, body: {b: 2} ).run @example Create a request and allow follow redirections. response = Typhoeus::Request.new( "www.example.com", followlocation: true ).run @param [ String ] base_url The url to request. @param [ options ] options The options. @option options [ Hash ] :params Translated into url parameters. @option options [ Hash ] :body Translated into HTTP POST request body. @return [ Typhoeus::Request ] The request. @note See {http://rubydoc.info/github/typhoeus/ethon/Ethon/Easy/Options Ethon::Easy::Options} for more options. @see Typhoeus::Hydra @see Typhoeus::Response @see Typhoeus::Request::Actions
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def url easy = EasyFactory.new(self).get url = easy.url Typhoeus::Pool.release(easy) url end
Return the url. In contrast to base_url which returns the value you specified, url returns the full url including the parameters. @example Get the url. request.url @since 0.5.5
url
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def eql?(other) self.class == other.class && self.base_url == other.base_url && fuzzy_hash_eql?(self.options, other.options) end
Returns whether other is equal to self. @example Are request equal? request.eql?(other_request) @param [ Object ] other The object to check. @return [ Boolean ] Returns true if equal, else false. @api private
eql?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def hash Zlib.crc32 cache_key end
Overrides Object#hash. @return [ Integer ] The integer representing the request. @api private
hash
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def cache_key Digest::SHA1.hexdigest "#{self.class.name}#{base_url}#{hashable_string_for(options)}" end
Returns a cache key for use with caching methods that required a string for a key. Will get used by ActiveSupport::Cache stores automatically. @return [ String ] The cache key.
cache_key
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def encoded_body Ethon::Easy::Form.new(nil, options[:body]).to_s end
Mimics libcurls POST body generation. This is not accurate, but good enough for VCR. @return [ String ] The encoded body. otherwise. @api private
encoded_body
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def fuzzy_hash_eql?(left, right) return true if (left == right) (left.count == right.count) && left.inject(true) do |res, kvp| res && (kvp[1] == right[kvp[0]]) end end
Checks if two hashes are equal or not, discarding first-level hash order. @param [ Hash ] left @param [ Hash ] right hash to check for equality @return [ Boolean ] Returns true if hashes have same values for same keys and same length, even if the keys are given in a different order.
fuzzy_hash_eql?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def set_defaults default_user_agent = Config.user_agent || Typhoeus::USER_AGENT options[:headers] = {'User-Agent' => default_user_agent}.merge(options[:headers] || {}) options[:headers]['Expect'] ||= '' options[:verbose] = Typhoeus::Config.verbose if options[:verbose].nil? && !Typhoeus::Config.verbose.nil? options[:maxredirs] ||= 50 options[:proxy] = Typhoeus::Config.proxy unless options.has_key?(:proxy) || Typhoeus::Config.proxy.nil? end
Sets default header and verbose when turned on.
set_defaults
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request.rb
Apache-2.0
def initialize(options = {}) @options = options @headers = Header.new(options[:headers]) if options[:headers] end
Create a new response. @example Create a response. Response.new @param [ Hash ] options The options hash. @return [ Response ] The new response.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response.rb
Apache-2.0
def mock defined?(@mock) ? @mock : options[:mock] end
Returns whether this request is mocked or not. @api private
mock
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response.rb
Apache-2.0
def handled_response @handled_response || self end
Returns the handled_response if it has been defined; otherwise, returns the response @return [ Object ] The result of callbacks done on the response or the original response.
handled_response
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response.rb
Apache-2.0
def initialize(app, adapter_options = {}) super(app) @adapter_options = adapter_options end
Initialize the Typhoeus adapter @param [ App ] app Farday app @option [ Hash ] adapter_options Typhoeus options @return [ void ]
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/adapters/faraday.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/adapters/faraday.rb
Apache-2.0
def call(env) super perform_request env @app.call env end
Hook into Faraday and perform the request with Typhoeus. @param [ Hash ] env The environment. @return [ void ]
call
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/adapters/faraday.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/adapters/faraday.rb
Apache-2.0
def initialize(client = ::Dalli::Client.new, options = {}) @client = client @default_ttl = options[:default_ttl] end
@example Set Dalli as the Typhoeus cache backend Typhoeus::Config.cache = Typhoeus::Cache::Dalli.new @param [ Dalli::Client ] client A connection to the cache server. Defaults to `Dalli::Client.new` @param [ Hash ] options Options @option options [ Integer ] :default_ttl The default TTL of cached responses in seconds, for requests which do not set a cache_ttl.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/cache/dalli.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/cache/dalli.rb
Apache-2.0
def initialize(cache = ::Rails.cache, options = {}) @cache = cache @default_ttl = options[:default_ttl] end
@example Use the Rails cache setup to cache Typhoeus responses. Typhoeus::Config.cache = Typhoeus::Cache::Rails.new @param [ ActiveSupport::Cache::Store ] cache A Rails cache backend. Defaults to Rails.cache. @param [ Hash ] options Options @option options [ Integer ] :default_ttl The default TTL of cached responses in seconds, for requests which do not set a cache_ttl.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/cache/rails.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/cache/rails.rb
Apache-2.0
def initialize(redis = ::Redis.new, options = {}) @redis = redis @default_ttl = options[:default_ttl] end
@example Set Redis as the Typhoeus cache backend Typhoeus::Config.cache = Typhoeus::Cache::Redis.new @param [ Redis ] redis A connection to Redis. Defaults to `Redis.new`, which uses the `REDIS_URL` environment variable to connect @param [ Hash ] options Options @option options [ Integer ] :default_ttl The default TTL of cached responses in seconds, for requests which do not set a cache_ttl.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/cache/redis.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/cache/redis.rb
Apache-2.0
def add(request) multi.add(EasyFactory.new(request, self).get) end
Adds request to multi. @example Add request. hydra.add(request) @param [ Typhoeus::Request ] request to add. @return [ void ]
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/addable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/addable.rb
Apache-2.0
def add(request) Typhoeus.before.each do |callback| value = callback.call(request) if value.nil? || value == false || value.is_a?(Response) dequeue return value end end super end
Overrride add in order to execute callbacks in Typhoeus.before. Will break and return when a callback returns nil, false or a response. Calls super otherwise. @example Add the request. hydra.add(request)
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/before.rb
Apache-2.0
def add(request) if request.blocked? raise Typhoeus::Errors::NoStub.new(request) else super end end
Overrides add in order to check before if block connection is turned on. If thats the case a NoStub error is raised. @example Add the request. hydra.add(request) @param [ Request ] request The request to enqueue.
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/block_connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/block_connection.rb
Apache-2.0
def memory @memory ||= {} end
Return the memory. @example Return the memory. hydra.memory @return [ Hash ] The memory.
memory
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/memoizable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/memoizable.rb
Apache-2.0
def add(request) if request.memoizable? && memory.has_key?(request) response = memory[request] request.finish(response, true) dequeue else super end end
Overrides add in order to check before if request is memoizable and already in memory. If thats the case, super is not called, instead the response is set and the on_complete callback called. @example Add the request. hydra.add(request) @param [ Request ] request The request to add. @return [ Request ] The added request.
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/memoizable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/memoizable.rb
Apache-2.0
def run super memory.clear end
Overrides run to make sure the memory is cleared after each run. @example Run hydra. hydra.run
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/memoizable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/memoizable.rb
Apache-2.0
def queued_requests @queued_requests ||= [] end
Return the queued requests. @example Return queued requests. hydra.queued_requests @return [ Array<Typhoeus::Request> ] The queued requests.
queued_requests
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
Apache-2.0
def queue(request) request.hydra = self queued_requests << request end
Enqueues a request in order to be performed by the hydra. This can even be done while the hydra is running. Also sets hydra on request. @example Queue request. hydra.queue(request)
queue
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
Apache-2.0
def queue_front(request) request.hydra = self queued_requests.unshift request end
Pushes a request to the front of the queue, to be performed by the hydra. Also sets hydra on request @example Queue reques. hydra.queue_front(request)
queue_front
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
Apache-2.0
def dequeue add(queued_requests.shift) unless queued_requests.empty? end
Removes a request from queued_requests and adds it to the hydra in order to be performed next. @example Dequeue request. hydra.dequeue @since 0.6.4
dequeue
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
Apache-2.0
def dequeue_many number = multi.easy_handles.count until number == max_concurrency || queued_requests.empty? add(queued_requests.shift) number += 1 end end
Removes requests from queued_requests and adds them to the hydra until max_concurrency is reached. @example Dequeue requests. hydra.dequeue_many @since 0.6.8
dequeue_many
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/queueable.rb
Apache-2.0
def run dequeue_many multi.perform end
Start the hydra run. @example Start hydra run. hydra.run @return [ Symbol ] Return value from multi.perform.
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/runnable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/runnable.rb
Apache-2.0
def add(request) if response = Expectation.response_for(request) request.execute_headers_callbacks(response) request.on_body.each{ |callback| callback.call(response.body, response) } request.finish(response) else super end end
Override add in order to check for matching expecations. When an expecation is found, super is not called. Instead a canned response is assigned to the request. @example Add the request. hydra.add(request)
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
Apache-2.0
def get(base_url, options = {}) Request.new(base_url, options.merge(:method => :get)).run end
Make a get request. @example Make get request. Typhoeus.get("www.example.com") @param (see Typhoeus::Request#initialize) @option (see Typhoeus::Request#initialize) @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
get
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def post(base_url, options = {}) Request.new(base_url, options.merge(:method => :post)).run end
Make a post request. @example Make post request. Typhoeus.post("www.example.com") @param (see Typhoeus::Request#initialize) @option (see Typhoeus::Request#initialize) @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
post
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def put(base_url, options = {}) Request.new(base_url, options.merge(:method => :put)).run end
Make a put request. @example Make put request. Typhoeus.put("www.example.com") @param (see Typhoeus::Request#initialize) @option options :params [ Hash ] Params hash which is attached to the base_url. @option options :body [ Hash ] Body hash which becomes a PUT request body. @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
put
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def delete(base_url, options = {}) Request.new(base_url, options.merge(:method => :delete)).run end
Make a delete request. @example Make delete request. Typhoeus.delete("www.example.com") @param (see Typhoeus::Request#initialize) @option (see Typhoeus::Request#initialize) @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
delete
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def head(base_url, options = {}) Request.new(base_url, options.merge(:method => :head)).run end
Make a head request. @example Make head request. Typhoeus.head("www.example.com") @param (see Typhoeus::Request#initialize) @option (see Typhoeus::Request#initialize) @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
head
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def patch(base_url, options = {}) Request.new(base_url, options.merge(:method => :patch)).run end
Make a patch request. @example Make patch request. Typhoeus.patch("www.example.com") @param (see Typhoeus::Request#initialize) @option (see Typhoeus::Request#initialize) @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
patch
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def options(base_url, options = {}) Request.new(base_url, options.merge(:method => :options)).run end
Make a options request. @example Make options request. Typhoeus.options("www.example.com") @param (see Typhoeus::Request#initialize) @option (see Typhoeus::Request#initialize) @return (see Typhoeus::Response#initialize) @note (see Typhoeus::Request#initialize)
options
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/actions.rb
Apache-2.0
def run Typhoeus.before.each do |callback| value = callback.call(self) if value.nil? || value == false || value.is_a?(Response) return response end end super end
Overrride run in order to execute callbacks in Typhoeus.before. Will break and return when a callback returns nil or false. Calls super otherwise. @example Run the request. request.run
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb
Apache-2.0
def run if blocked? raise Typhoeus::Errors::NoStub.new(self) else super end end
Overrides run in order to check before if block connection is turned on. If thats the case a NoStub error is raised. @example Run request. request.run @raise [Typhoeus::Errors::NoStub] If connection is blocked and no stub defined.
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/block_connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/block_connection.rb
Apache-2.0
def blocked? if block_connection.nil? Typhoeus::Config.block_connection else block_connection end end
Returns wether a request is blocked or not. Takes request.block_connection and Typhoeus::Config.block_connection into consideration. @example Blocked? request.blocked? @return [ Boolean ] True if blocked, false else.
blocked?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/block_connection.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/block_connection.rb
Apache-2.0
def on_complete(&block) @on_complete ||= [] @on_complete << block if block_given? @on_complete end
Set on_complete callback. @example Set on_complete. request.on_complete { |response| p "yay" } @param [ Block ] block The block to execute. @yield [ Typhoeus::Response ] @return [ Array<Block> ] All on_complete blocks.
on_complete
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def on_success(&block) @on_success ||= [] @on_success << block if block_given? @on_success end
Set on_success callback. @example Set on_success. request.on_success { |response| p "yay" } @param [ Block ] block The block to execute. @yield [ Typhoeus::Response ] @return [ Array<Block> ] All on_success blocks.
on_success
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def on_failure(&block) @on_failure ||= [] @on_failure << block if block_given? @on_failure end
Set on_failure callback. @example Set on_failure. request.on_failure { |response| p "yay" } @param [ Block ] block The block to execute. @yield [ Typhoeus::Response ] @return [ Array<Block> ] All on_failure blocks.
on_failure
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def on_headers(&block) @on_headers ||= [] @on_headers << block if block_given? @on_headers end
Set on_headers callback. @example Set on_headers. request.on_headers { |response| p "yay" } @param [ Block ] block The block to execute. @yield [ Typhoeus::Response ] @return [ Array<Block> ] All on_headers blocks.
on_headers
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def on_progress(&block) @on_progress ||= [] @on_progress << block if block_given? @on_progress end
Set on_progress callback. @example Set on_progress. request.on_progress do |dltotal, dlnow, ultotal, ulnow| puts "dltotal (#{dltotal}), dlnow (#{dlnow}), ultotal (#{ultotal}), ulnow (#{ulnow})" end @param [ Block ] block The block to execute. @yield [ Typhoeus::Response ] @return [ Array<Block> ] All on_progress blocks.
on_progress
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def execute_headers_callbacks(response) (Typhoeus.on_headers + on_headers).map do |callback| callback.call(response) end end
Execute the headers callbacks and yields response. @example Execute callbacks. request.execute_headers_callbacks @return [ Array<Object> ] The results of the on_headers callbacks. @api private
execute_headers_callbacks
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def execute_callbacks callbacks = Typhoeus.on_complete + Typhoeus.on_progress + on_complete + on_progress if response && response.success? callbacks += Typhoeus.on_success + on_success elsif response callbacks += Typhoeus.on_failure + on_failure end callbacks.each do |callback| self.response.handled_response = callback.call(self.response) end end
Execute necessary callback and yields response. This include in every case on_complete and on_progress, on_success if successful and on_failure if not. @example Execute callbacks. request.execute_callbacks @return [ void ] @api private
execute_callbacks
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/callbacks.rb
Apache-2.0
def marshal_dump unmarshallable = %w(@on_complete @on_success @on_failure @on_progress @on_headers @on_body @hydra) (instance_variables - unmarshallable - unmarshallable.map(&:to_sym)).map do |name| [name, instance_variable_get(name)] end end
Return the important data needed to serialize this Request, except the request callbacks and `hydra`, since they cannot be marshalled.
marshal_dump
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/marshal.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/marshal.rb
Apache-2.0
def memoizable? Typhoeus::Config.memoize && (options[:method].nil? || options[:method] == :get) end
Return whether a request is memoizable. @example Is request memoizable? request.memoizable? @return [ Boolean ] Return true if memoizable, false else.
memoizable?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/memoizable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/memoizable.rb
Apache-2.0
def run easy = EasyFactory.new(self).get easy.perform response end
Run a request. @example Run a request. Typhoeus::Request.new("www.example.com").run @return [ Response ] The response.
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/operations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/operations.rb
Apache-2.0
def finish(response, bypass_memoization = nil) if bypass_memoization @response = response else self.response = response end self.response.request = self execute_callbacks response end
Sets a response, the request on the response and executes the callbacks. @param [Typhoeus::Response] response The response. @param [Boolean] bypass_memoization Wether to bypass memoization or not. Decides how the response is set. @return [Typhoeus::Response] The response.
finish
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/operations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/operations.rb
Apache-2.0
def response @response ||= nil end
Return the response. @example Return response. request.response @return [ Response ] The response.
response
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/responseable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/responseable.rb
Apache-2.0
def on_body(&block) @on_body ||= [] @on_body << block if block_given? @on_body end
Set on_body callback. This callback will be called each time a portion of the body is read from the socket. Setting an on_body callback will cause the response body to be empty. @example Set on_body. request.on_body { |body_chunk, response| puts "Got #{body_chunk.bytesize} bytes" } @param [ Block ] block The block to execute. @yield [ Typhoeus::Response, String ] @return [ Array<Block> ] All on_body blocks.
on_body
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
Apache-2.0
def streaming? defined?(@on_body) && @on_body.any? end
Is this request using streaming? @return [ Boolean ] True if any on_body blocks have been set.
streaming?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
Apache-2.0
def run if response = Expectation.response_for(self) execute_headers_callbacks(response) self.on_body.each{ |callback| callback.call(response.body, response) } finish(response) else super end end
Override run in order to check for matching expectations. When an expectation is found, super is not called. Instead a canned response is assigned to the request. @example Run the request. request.run @return [ Response ] The response.
run
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/stubbable.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/stubbable.rb
Apache-2.0
def initialize(raw) super({}) @raw = raw @sanitized = {} parse end
Create a new header. @example Create new header. Header.new(raw) @param [ String ] raw The raw header.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def parse case @raw when Hash raw.each do |k, v| process_pair(k, v) end when String raw.split(/\r?\n(?!\s)/).each do |header| header.strip! next if header.empty? || header.start_with?( 'HTTP/' ) process_line(header) end end end
Parses the raw header. @example Parse header. header.parse
parse
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def process_line(header) key, value = header.split(':', 2) process_pair(key.strip, (value ? value.strip.gsub(/\r?\n\s*/, ' ') : '')) end
Processes line and saves the result. @return [ void ]
process_line
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def process_pair(key, value) set_value(key, value, self) @sanitized[key.downcase] = self[key] end
Sets key value pair for self and @sanitized. @return [ void ]
process_pair
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def set_value(key, value, hash) current_value = hash[key] if current_value if current_value.is_a? Array current_value << value else hash[key] = [current_value, value] end else hash[key] = value end end
Sets value for key in specified hash @return [ void ]
set_value
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def raw @raw || '' end
Returns the raw header or empty string. @example Return raw header. header.raw @return [ String ] The raw header.
raw
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def set_default_proc_on(hash, default_proc) if hash.respond_to?(:default_proc=) hash.default_proc = default_proc else hash.replace(Hash.new(&default_proc).merge(hash)) end end
Sets the default proc for the specified hash independent of the Ruby version. @return [ void ]
set_default_proc_on
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/header.rb
Apache-2.0
def return_message Ethon::Curl.easy_strerror(return_code) if return_code end
Returns a string describing the return. @example Get return_message. response.return_message @return [ String ] The return_message. @since 0.6.2
return_message
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def response_body options[:response_body] || options[:body] end
Return the http response body. @example Get response_body. response.response_body @return [ String ] The response_body.
response_body
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def response_headers return options[:response_headers] if options[:response_headers] if mock? && h = options[:headers] status_code = return_code || "200" reason_phrase = status_code == "200" ? "OK" : "Mock Reason Phrase" status_line = "HTTP/1.1 #{status_code} #{reason_phrase}" actual_headers = h.map{ |k,v| [k, v.respond_to?(:join) ? v.join(',') : v] }. map{ |e| "#{e.first}: #{e.last}" } [status_line, *actual_headers].join("\r\n") end end
Return the http response headers. @example Get response_headers. response.response_headers @return [ String ] The response_headers.
response_headers
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def response_code (options[:response_code] || options[:code]).to_i end
Return the last received HTTP, FTP or SMTP response code. The value will be zero if no server response code has been received. Note that a proxy's CONNECT response should be read with http_connect_code and not this. @example Get response_code. response.response_code @return [ Integer ] The response_code.
response_code
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def total_time options[:total_time] || options[:time] end
Return the total time in seconds for the previous transfer, including name resolving, TCP connect etc. @example Get total_time. response.total_time @return [ Float ] The total_time.
total_time
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def starttransfer_time options[:starttransfer_time] || options[:start_transfer_time] end
Return the time, in seconds, it took from the start until the first byte is received by libcurl. This includes pretransfer time and also the time the server needs to calculate the result. @example Get starttransfer_time. response.starttransfer_time @return [ Float ] The starttransfer_time.
starttransfer_time
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def appconnect_time options[:appconnect_time] || options[:app_connect_time] end
Return the time, in seconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed. This time is most often very near to the pre transfer time, except for cases such as HTTP pipelining where the pretransfer time can be delayed due to waits in line for the pipeline and more. @example Get appconnect_time. response.appconnect_time @return [ Float ] The appconnect_time.
appconnect_time
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def namelookup_time options[:namelookup_time] || options[:name_lookup_time] end
Return the time, in seconds, it took from the start until the name resolving was completed. @example Get namelookup_time. response.namelookup_time @return [ Float ] The namelookup_time.
namelookup_time
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def headers return Header.new(options[:headers]) if mock? && options[:headers] return nil if response_headers.nil? && !defined?(@headers) @headers ||= Header.new(response_headers.split("\r\n\r\n").last) end
Returns the response header. @example Return headers. response.headers @return [ Typhoeus::Header ] The response header.
headers
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def redirections return [] unless response_headers response_headers.split("\r\n\r\n")[0..-2].map{ |h| Response.new(:response_headers => h) } end
Return all redirections in between as multiple responses with header. @example Return redirections. response.redirections @return [ Array<Typhoeus::Response> ] The redirections
redirections
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/informations.rb
Apache-2.0
def status_message return @status_message if defined?(@status_message) && @status_message return options[:status_message] unless options[:status_message].nil? # HTTP servers can choose not to include the explanation to HTTP codes. The RFC # states this (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4): # Except when responding to a HEAD request, the server SHOULD include an entity containing # an explanation of the error situation [...] # This means 'HTTP/1.1 404' is as valid as 'HTTP/1.1 404 Not Found' and we have to handle it. # # Regexp doc: http://rubular.com/r/eAr1oVYsVa if first_header_line != nil and first_header_line[/\d{3} (.*)$/, 1] != nil @status_message = first_header_line[/\d{3} (.*)$/, 1].chomp else @status_message = nil end end
Return the status message if present. @example Return status message. reesponse.status_message @return [ String ] The message.
status_message
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
Apache-2.0
def http_version @http_version ||= first_header_line ? first_header_line[/HTTP\/(\S+)/, 1] : nil end
Return the http version. @example Return http version. response.http_version @return [ String ] The http version.
http_version
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
Apache-2.0
def success? (mock || return_code == :ok) && response_code && has_good_response_code? end
Return whether the response is a success. @example Return if the response was successful. response.success? @return [ Boolean ] Return true if successful, false else.
success?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
Apache-2.0
def failure? (mock || return_code == :internal_server_error) && response_code && has_bad_response_code? end
Return whether the response is a failure. @example Return if the response was failed. response.failure? @return [ Boolean ] Return true if failure, false else.
failure?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
Apache-2.0
def modified? (mock || return_code == :ok) && response_code && response_code != 304 end
Return wether the response is modified. @example Return if the response was modified. response.modified? @return [ Boolean ] Return true if modified, false else.
modified?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
Apache-2.0
def timed_out? return_code == :operation_timedout end
Return whether the response is timed out. @example Return if the response timed out. response.timed_out? @return [ Boolean ] Return true if timed out, false else.
timed_out?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/response/status.rb
Apache-2.0
def initialize(std_offset, dst_offset, dst_start_rule, dst_end_rule) @std_offset = std_offset @dst_offset = dst_offset @dst_start_rule = dst_start_rule @dst_end_rule = dst_end_rule end
Initializes a new {AnnualRules} instance. @param std_offset [TimezoneOffset] the standard offset that applies when daylight savings time is not in force. @param dst_offset [TimezoneOffset] the offset that applies when daylight savings time is in force. @param dst_start_rule [TransitionRule] the rule that determines when daylight savings time starts. @param dst_end_rule [TransitionRule] the rule that determines when daylight savings time ends.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/annual_rules.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/annual_rules.rb
Apache-2.0
def transitions(year) start_dst = apply_rule(@dst_start_rule, @std_offset, @dst_offset, year) end_dst = apply_rule(@dst_end_rule, @dst_offset, @std_offset, year) end_dst.timestamp_value < start_dst.timestamp_value ? [end_dst, start_dst] : [start_dst, end_dst] end
Returns the transitions between standard and daylight savings time for a given year. The results are ordered by time of occurrence (earliest to latest). @param year [Integer] the year to calculate transitions for. @return [Array<TimezoneTransition>] the transitions for the year.
transitions
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/annual_rules.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/annual_rules.rb
Apache-2.0
def apply_rule(rule, from_offset, to_offset, year) at = rule.at(from_offset, year) TimezoneTransition.new(to_offset, from_offset, at.value) end
Applies a given rule between offsets on a year. @param rule [TransitionRule] the rule to apply. @param from_offset [TimezoneOffset] the offset the rule transitions from. @param to_offset [TimezoneOffset] the offset the rule transitions to. @param year [Integer] the year when the transition occurs. @return [TimezoneTransition] the transition determined by the rule.
apply_rule
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/annual_rules.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/annual_rules.rb
Apache-2.0
def all data_source.country_codes.collect {|code| get(code)} end
@return [Array<Country>] an `Array` containing one {Country} instance for each defined country.
all
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
Apache-2.0
def initialize(info) @info = info end
Initializes a new {Country} based upon a {DataSources::CountryInfo} instance. {Country} instances should not normally be constructed directly. Use the {Country.get} method to obtain instances instead. @param info [DataSources::CountryInfo] the data to base the new {Country} instance upon.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
Apache-2.0
def inspect "#<#{self.class}: #{@info.code}>" end
@return [String] the internal object state as a programmer-readable `String`.
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
Apache-2.0
def eql?(c) self == c end
@param c [Object] an `Object` to compare this {Country} with. @return [Boolean] `true` if `c` is an instance of {Country} and has the same code as `self`, otherwise `false`.
eql?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country.rb
Apache-2.0
def initialize(identifier, latitude, longitude, description = nil) @identifier = identifier.freeze @latitude = latitude @longitude = longitude @description = description && description.freeze end
Creates a new {CountryTimezone}. The passed in identifier and description instances will be frozen. {CountryTimezone} instances should normally only be constructed by implementations of {DataSource}. @param identifier [String] the {Timezone} identifier. @param latitude [Rational] the latitude of the time zone. @param longitude [Rational] the longitude of the time zone. @param description [String] an optional description of the time zone.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
Apache-2.0
def description_or_friendly_identifier description || timezone.friendly_identifier(true) end
@return [String] the {description} if present, otherwise a human-readable representation of the identifier (using {Timezone#friendly_identifier}).
description_or_friendly_identifier
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
Apache-2.0
def eql?(ct) self == ct end
Tests if the given object is equal to the current instance (has the same identifier, latitude, longitude and description). @param ct [Object] the object to be compared. @return [Boolean] `true` if `ct` is equal to the current instance.
eql?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
Apache-2.0
def hash [@identifier, @latitude, @longitude, @description].hash end
@return [Integer] a hash based on the {identifier}, {latitude}, {longitude} and {description}.
hash
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/country_timezone.rb
Apache-2.0
def get # If a DataSource hasn't been manually set when the first request is # made to obtain a DataSource, then a default data source is created. # # This is done at the first request rather than when TZInfo is loaded to # avoid unnecessary attempts to find a suitable DataSource. # # A `Mutex` is used to ensure that only a single default instance is # created (this avoiding the possibility of retaining two copies of the # same data in memory). unless @@instance @@default_mutex.synchronize do set(create_default_data_source) unless @@instance end end @@instance end
@return [DataSource] the currently selected source of data.
get
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_source.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_source.rb
Apache-2.0
def set(data_source_or_type, *args) if data_source_or_type.kind_of?(DataSource) @@instance = data_source_or_type elsif data_source_or_type == :ruby @@instance = DataSources::RubyDataSource.new elsif data_source_or_type == :zoneinfo @@instance = DataSources::ZoneinfoDataSource.new(*args) else raise ArgumentError, 'data_source_or_type must be a DataSource instance or a data source type (:ruby or :zoneinfo)' end end
Sets the currently selected data source for time zone and country data. This should usually be set to one of the two standard data source types: * `:ruby` - read data from the Ruby modules included in the TZInfo::Data library (tzinfo-data gem). * `:zoneinfo` - read data from the zoneinfo files included with most Unix-like operating systems (e.g. in /usr/share/zoneinfo). To set TZInfo to use one of the standard data source types, call `TZInfo::DataSource.set`` in one of the following ways: TZInfo::DataSource.set(:ruby) TZInfo::DataSource.set(:zoneinfo) TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir) TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file) `DataSource.set(:zoneinfo)` will automatically search for the zoneinfo directory by checking the paths specified in {DataSources::ZoneinfoDataSource.search_path}. {DataSources::ZoneinfoDirectoryNotFound} will be raised if no valid zoneinfo directory could be found. `DataSource.set(:zoneinfo, zoneinfo_dir)` uses the specified `zoneinfo_dir` directory as the data source. If the directory is not a valid zoneinfo directory, a {DataSources::InvalidZoneinfoDirectory} exception will be raised. `DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file)` uses the specified `zoneinfo_dir` directory as the data source, but loads the `iso3166.tab` file from the path given by `iso3166_tab_file`. If the directory is not a valid zoneinfo directory, a {DataSources::InvalidZoneinfoDirectory} exception will be raised. Custom data sources can be created by subclassing TZInfo::DataSource and implementing the following methods: * {load_timezone_info} * {data_timezone_identifiers} * {linked_timezone_identifiers} * {load_country_info} * {country_codes} To have TZInfo use the custom data source, call {DataSource.set}, passing an instance of the custom data source implementation as follows: TZInfo::DataSource.set(CustomDataSource.new) Calling {DataSource.set} will only affect instances of {Timezone} and {Country} obtained with {Timezone.get} and {Country.get} subsequent to the {DataSource.set} call. Existing {Timezone} and {Country} instances will be unaffected. If {DataSource.set} is not called, TZInfo will by default attempt to use TZInfo::Data as the data source. If TZInfo::Data is not available (i.e. if `require 'tzinfo/data'` fails), then TZInfo will search for a zoneinfo directory instead (using the search path specified by {DataSources::ZoneinfoDataSource.search_path}). @param data_source_or_type [Object] either `:ruby`, `:zoneinfo` or an instance of a {DataSource}. @param args [Array<Object>] when `data_source_or_type` is a symbol, optional arguments to use when initializing the data source. @raise [ArgumentError] if `data_source_or_type` is not `:ruby`, `:zoneinfo` or an instance of {DataSource}.
set
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_source.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_source.rb
Apache-2.0
def create_default_data_source has_tzinfo_data = false begin require 'tzinfo/data' has_tzinfo_data = true rescue LoadError end return DataSources::RubyDataSource.new if has_tzinfo_data begin return DataSources::ZoneinfoDataSource.new rescue DataSources::ZoneinfoDirectoryNotFound raise DataSourceNotFound, "No source of timezone data could be found.\nPlease refer to https://tzinfo.github.io/datasourcenotfound for help resolving this error." end end
Creates a {DataSource} instance for use as the default. Used if no preference has been specified manually. @return [DataSource] the newly created default {DataSource} instance.
create_default_data_source
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_source.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_source.rb
Apache-2.0