Module: HTTPotato

Extended by:
AllowedFormatsDeprecation
Included in:
Basement
Defined in:
lib/httpotato.rb,
lib/httpotato/parser.rb,
lib/httpotato/request.rb,
lib/httpotato/response.rb,
lib/httpotato/exceptions.rb,
lib/httpotato/core_extensions.rb,
lib/httpotato/module_inheritable_attributes.rb

Defined Under Namespace

Modules: AllowedFormatsDeprecation, ClassMethods, ModuleInheritableAttributes Classes: Basement, BasicObject, CookieHash, ParseError, Parser, RedirectionTooDeep, Request, Response, ResponseError, UnsupportedFormat, UnsupportedURIScheme

Constant Summary collapse

VERSION =
"1.0.2".freeze
CRACK_DEPENDENCY =
"0.1.8".freeze
JSON_DEPENDENCY =
"1.4.6".freeze

Class Method Summary collapse

Methods included from AllowedFormatsDeprecation

const_missing

Class Method Details

.delete(*args) ⇒ Object



345
346
347
# File 'lib/httpotato.rb', line 345

def self.delete(*args)
  Basement.delete(*args)
end

.get(*args) ⇒ Object



333
334
335
# File 'lib/httpotato.rb', line 333

def self.get(*args)
  Basement.get(*args)
end

.head(*args) ⇒ Object



349
350
351
# File 'lib/httpotato.rb', line 349

def self.head(*args)
  Basement.head(*args)
end

.included(base) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/httpotato.rb', line 33

def self.included(base)
  base.extend ClassMethods
  base.send :include, HTTPotato::ModuleInheritableAttributes
  base.send(:mattr_inheritable, :default_options)
  base.send(:mattr_inheritable, :default_cookies)
  base.instance_variable_set("@default_options", {})
  base.instance_variable_set("@default_cookies", CookieHash.new)
end

.normalize_base_uri(url) ⇒ Object

:nodoc:



318
319
320
321
322
323
324
325
326
327
# File 'lib/httpotato.rb', line 318

def self.normalize_base_uri(url) #:nodoc:
  normalized_url = url.dup
  use_ssl = (normalized_url =~ /^https/) || normalized_url.include?(':443')
  ends_with_slash = normalized_url =~ /\/$/

  normalized_url.chop! if ends_with_slash
  normalized_url.gsub!(/^https?:\/\//i, '')

  "http#{'s' if use_ssl}://#{normalized_url}"
end

.options(*args) ⇒ Object



353
354
355
# File 'lib/httpotato.rb', line 353

def self.options(*args)
  Basement.options(*args)
end

.post(*args) ⇒ Object



337
338
339
# File 'lib/httpotato.rb', line 337

def self.post(*args)
  Basement.post(*args)
end

.put(*args) ⇒ Object



341
342
343
# File 'lib/httpotato.rb', line 341

def self.put(*args)
  Basement.put(*args)
end