Module: HTTParty

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

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods, Html, Json, ModuleInheritableAttributes, Text, Xml, Yaml Classes: Basement, CookieHash, 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,
  'application/x-yaml'     => :yaml,
  'text/yaml'              => :yaml,
  'text/plain'             => :plain
}
Version =
'0.4.4'

Class Method Summary collapse

Class Method Details

.delete(*args) ⇒ Object



208
209
210
# File 'lib/httparty.rb', line 208

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

.get(*args) ⇒ Object



196
197
198
# File 'lib/httparty.rb', line 196

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

.included(base) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/httparty.rb', line 28

def self.included(base)
  base.extend ClassMethods
  base.send :include, HTTParty::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:



181
182
183
184
185
186
187
188
189
190
# File 'lib/httparty.rb', line 181

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

.post(*args) ⇒ Object



200
201
202
# File 'lib/httparty.rb', line 200

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

.put(*args) ⇒ Object



204
205
206
# File 'lib/httparty.rb', line 204

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