playapi 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/playapi/utils.rb +8 -9
- metadata +2 -2
data/lib/playapi/utils.rb
CHANGED
|
@@ -10,7 +10,6 @@ module Playapi
|
|
|
10
10
|
|
|
11
11
|
def get_objects(method, key, path, options={})
|
|
12
12
|
res = Playapi.client.send(:request, method.to_sym, path, options)
|
|
13
|
-
puts "\n\n#{res.inspect}\n\n"
|
|
14
13
|
if res[:status] == 200
|
|
15
14
|
res[:body][key].collect{|y| sym_hash = convert_string_hash_to_sym(y); eval "#{sym_hash[:type]}.new(#{sym_hash})"}
|
|
16
15
|
else
|
|
@@ -21,22 +20,22 @@ module Playapi
|
|
|
21
20
|
|
|
22
21
|
def get_object(method, key, path, options={})
|
|
23
22
|
res = Playapi.client.send(:request, method.to_sym, path, options)
|
|
24
|
-
if res
|
|
25
|
-
sym_hash = convert_string_hash_to_sym(res
|
|
23
|
+
if res[:status] == 200
|
|
24
|
+
sym_hash = convert_string_hash_to_sym(res[:body][key])
|
|
26
25
|
eval "#{sym_hash[:type]}.new(#{sym_hash})"
|
|
27
26
|
else
|
|
28
|
-
errors = res
|
|
29
|
-
raise "Error returned: #{res
|
|
27
|
+
errors = res[:body]["errors"]
|
|
28
|
+
raise "Error returned: #{res[:status]} #{errors}"
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
def get_raw
|
|
34
33
|
res = Playapi.client.send(:request, method.to_sym, path, options)
|
|
35
|
-
if res
|
|
36
|
-
res
|
|
34
|
+
if res[:status] == 200
|
|
35
|
+
res[:body][key]
|
|
37
36
|
else
|
|
38
|
-
errors = res
|
|
39
|
-
raise "Error returned: #{res
|
|
37
|
+
errors = res[:body]["errors"]
|
|
38
|
+
raise "Error returned: #{res[:status]} #{errors}"
|
|
40
39
|
end
|
|
41
40
|
end
|
|
42
41
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Interact with PlayAPI
|
|
15
15
|
email: france@playapi.com
|