fanforce-base 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fanforce/base/internal_utils.rb +4 -4
- data/lib/fanforce/base/utils.rb +22 -10
- data/lib/fanforce/base/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35cb24522fef11bc78e979e89f12426ee56a5d21
|
4
|
+
data.tar.gz: 41ee6031a00df9eea1a228a691e5c399fc38b38d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d48e6a7d74d0a2ca6232b59997c907a698693e9ad26623ce3a52d01b5d28d635da5050c445ea15855405b9b333addd306c943970b0a2e87a41d2ce573cfe4f2
|
7
|
+
data.tar.gz: ea901ee15248766f9028c2b4d7d353e6592f346e95b7dd8535bb3d6a5d69d0e1f7252938870455016418fd7546bb1eb4ddc34b8224b4bfcd3053645438f14b05
|
@@ -19,15 +19,15 @@ module Fanforce::Base::InternalUtils
|
|
19
19
|
|
20
20
|
def self.to_param(obj, namespace=nil)
|
21
21
|
if obj.is_a?(Array)
|
22
|
-
collect { |e| to_param(e) }.join '/'
|
22
|
+
obj.collect { |e| to_param(e) }.join '/'
|
23
23
|
elsif obj.is_a?(Hash)
|
24
24
|
to_query_string(obj, namespace)
|
25
25
|
elsif obj.is_a?(NilClass)
|
26
|
-
obj
|
26
|
+
obj.to_s
|
27
27
|
elsif obj.is_a?(TrueClass)
|
28
|
-
obj
|
28
|
+
obj.to_s
|
29
29
|
elsif obj.is_a?(FalseClass)
|
30
|
-
obj
|
30
|
+
obj.to_s
|
31
31
|
elsif obj.is_a?(Object)
|
32
32
|
obj.to_s
|
33
33
|
end
|
data/lib/fanforce/base/utils.rb
CHANGED
@@ -78,18 +78,30 @@ module Fanforce::Base::Utils
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
81
|
+
# Lifted from Rack::Utils.build_nested_query
|
82
|
+
#
|
83
|
+
def build_nested_query(value, prefix = nil)
|
84
|
+
case value
|
85
|
+
when Array
|
86
|
+
value.map { |v|
|
87
|
+
build_nested_query(v, "#{prefix}[]")
|
88
|
+
}.join("&")
|
89
|
+
when Hash
|
90
|
+
value.map { |k, v|
|
91
|
+
build_nested_query(v, prefix ? "#{prefix}[#{escape(k)}]" : escape(k))
|
92
|
+
}.reject(&:empty?).join('&')
|
93
|
+
when nil
|
94
|
+
prefix
|
95
|
+
else
|
96
|
+
raise ArgumentError, "value must be a Hash" if prefix.nil?
|
97
|
+
"#{prefix}=#{escape(value)}"
|
91
98
|
end
|
92
99
|
end
|
100
|
+
alias_method :to_query_string, :build_nested_query
|
101
|
+
|
102
|
+
def escape(s)
|
103
|
+
CGI.escape(Fanforce::Base::InternalUtils.to_param(s))
|
104
|
+
end
|
93
105
|
|
94
106
|
def curl_command(method, url, req_params)
|
95
107
|
case method.to_s.downcase.to_sym
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fanforce-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|