Module: HTTParty

Included in:
Basement
Defined in:
lib/httparty.rb,
lib/httparty/request.rb,
lib/httparty/version.rb,
lib/httparty/exceptions.rb

Defined Under Namespace

Modules: ClassMethods Classes: Basement, RedirectionTooDeep, Request, Response, UnsupportedFormat

Constant Summary collapse

AllowedFormats =
{
  'text/xml'               => :xml,
  'application/xml'        => :xml,
  'application/json'       => :json,
  'text/json'              => :json,
  'application/javascript' => :json,
  'text/javascript'        => :json,
  'text/html'              => :html
}
Version =
'0.2.6'

Class Method Summary collapse

Class Method Details

.delete(*args) ⇒ Object



114
115
116
# File 'lib/httparty.rb', line 114

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

.get(*args) ⇒ Object



102
103
104
# File 'lib/httparty.rb', line 102

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

.included(base) ⇒ Object



23
24
25
26
27
28
# File 'lib/httparty.rb', line 23

def self.included(base)
  base.extend ClassMethods
  base.send :include, ModuleLevelInheritableAttributes
  base.send(:mattr_inheritable, :default_options)
  base.instance_variable_set("@default_options", {})
end

.normalize_base_uri(url) ⇒ Object

:nodoc:



88
89
90
91
92
93
94
95
96
# File 'lib/httparty.rb', line 88

def self.normalize_base_uri(url) #:nodoc:
  use_ssl = (url =~ /^https/) || url.include?(':443')
  ends_with_slash = url =~ /\/$/
  
  url.chop! if ends_with_slash
  url.gsub!(/^https?:\/\//i, '')
  
  "http#{'s' if use_ssl}://#{url}"
end

.post(*args) ⇒ Object



106
107
108
# File 'lib/httparty.rb', line 106

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

.put(*args) ⇒ Object



110
111
112
# File 'lib/httparty.rb', line 110

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