Module: Gnarly::Client
- Defined in:
- lib/gnarly/client.rb,
lib/gnarly/client/test.rb,
lib/gnarly/client/emhttp.rb,
lib/gnarly/client/patron.rb,
lib/gnarly/client/typhoeus.rb
Defined Under Namespace
Modules: EMHttp, Patron, Test, Typhoeus
Class Method Summary
collapse
Class Method Details
.create_url(url) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/gnarly/client.rb', line 19
def self.create_url(url)
case url
when Array
path, params = url
sio = StringIO.new
sio << path
if params.size > 0
key, value = params.shift
sio << "?" << key << "=" << value
params.each_pair do |key, value|
sio << "&" << key << "=" << value
end
end
sio.string
else
url
end
end
|
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/gnarly/client.rb', line 8
def self.()
symbolized = {}
.each_pair do |key, value|
if value
sym = key.downcase.gsub('-', '_').to_sym
symbolized[sym] = value
end
end
symbolized
end
|
.url_encode(url) ⇒ Object
38
39
40
|
# File 'lib/gnarly/client.rb', line 38
def self.url_encode(url)
Addressable::URI::encode url
end
|