jugyo-rubytter 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/friends_timeline.rb +1 -1
- data/lib/rubytter.rb +16 -1
- metadata +1 -1
data/lib/rubytter.rb
CHANGED
@@ -4,6 +4,7 @@ require 'net/https'
|
|
4
4
|
require 'cgi'
|
5
5
|
|
6
6
|
require 'rubytter/connection'
|
7
|
+
require 'rubytter/hash_extension'
|
7
8
|
|
8
9
|
class Rubytter
|
9
10
|
APP_NAME = self.to_s
|
@@ -76,7 +77,21 @@ class Rubytter
|
|
76
77
|
res_text = @connection.start(@host) do |http|
|
77
78
|
http.request(req).body
|
78
79
|
end
|
79
|
-
|
80
|
+
json = JSON.parse(res_text)
|
81
|
+
return case json
|
82
|
+
when Array
|
83
|
+
json.map do |i|
|
84
|
+
if i.is_a?(Hash)
|
85
|
+
i.to_struct
|
86
|
+
else
|
87
|
+
i
|
88
|
+
end
|
89
|
+
end
|
90
|
+
when Hash
|
91
|
+
json.to_struct
|
92
|
+
else
|
93
|
+
json
|
94
|
+
end
|
80
95
|
end
|
81
96
|
|
82
97
|
def post(path, params = {})
|