mambanation 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/mambanation/base.rb +14 -15
- metadata +3 -3
data/VERSION.yml
CHANGED
data/lib/mambanation/base.rb
CHANGED
@@ -152,26 +152,13 @@ module MambaNation
|
|
152
152
|
end
|
153
153
|
|
154
154
|
# options:
|
155
|
-
# application_id Integer,
|
156
|
-
# posts Array, Hash, String
|
155
|
+
# application_id => Integer, Array
|
157
156
|
def user_posts(id, query = {})
|
158
|
-
query[:
|
157
|
+
query[:application_id] = urlencode_array({:application_id => query[:application_id]}) if query.is_a?(Hash) && query[:application_id]
|
159
158
|
|
160
159
|
perform_get("/users/#{id.to_i}/posts.json", :query => query)
|
161
160
|
end
|
162
161
|
|
163
|
-
def urlencode_array(value_hash)
|
164
|
-
return_string = ''
|
165
|
-
value_hash.each_pair do |k,v|
|
166
|
-
return_string = case v.class.to_s
|
167
|
-
when "Hash" then urlencode_array(v)
|
168
|
-
when "Array" then v.map { |value| value.is_a?(Hash) ? urlencode_array(value) : "#{k}[]=#{value}" }.join('&')
|
169
|
-
else "#{k}[]=#{v}"
|
170
|
-
end
|
171
|
-
end
|
172
|
-
return_string
|
173
|
-
end
|
174
|
-
|
175
162
|
def create_post(id, post, application_id, query = {})
|
176
163
|
perform_post("/posts", :body => { :user_id => id, :post => post, :application_id => application_id }.merge(query))
|
177
164
|
end
|
@@ -254,6 +241,18 @@ module MambaNation
|
|
254
241
|
|
255
242
|
private
|
256
243
|
|
244
|
+
def urlencode_array(value_hash)
|
245
|
+
return_string = ''
|
246
|
+
value_hash.each_pair do |k,v|
|
247
|
+
return_string = case v.class.to_s
|
248
|
+
when "Hash" then urlencode_array(v)
|
249
|
+
when "Array" then v.map { |value| value.is_a?(Hash) ? urlencode_array(value) : "#{k}[]=#{value}" }.join('&')
|
250
|
+
else "#{k}[]=#{v}"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
return_string
|
254
|
+
end
|
255
|
+
|
257
256
|
def request_options(opts={})
|
258
257
|
opts[:headers] ||= {}
|
259
258
|
opts[:headers].merge! "X-FB-COOKIES" => @fbs_cookies if @fbs_cookies
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mambanation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 45
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 27
|
10
|
+
version: 0.1.27
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "J\xC3\xA9r\xC3\xA9my Van de Wyngaert"
|