Class: HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/cap_recipes/tasks/http.rb

Class Method Summary collapse

Class Method Details

.encoding(response) ⇒ Object



17
18
19
20
# File 'lib/cap_recipes/tasks/http.rb', line 17

def encoding(response)
  return $1.downcase if response['content-type'] =~ /charset=(.*)/i
  return $1.downcase if response.body =~ /<meta.*?charset=([^"'>]+)/mi
end

.get(url, options = {}) ⇒ Object



8
9
10
# File 'lib/cap_recipes/tasks/http.rb', line 8

def get(url, options = {})
  execute(url, options)
end

.post(url, options = {}) ⇒ Object



12
13
14
15
# File 'lib/cap_recipes/tasks/http.rb', line 12

def post(url, options = {})
  options = { :method => :post }.merge(options)
  execute(url, options)
end