motion-rails-model 0.0.1.3 → 0.0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/motion-rails-model/model.rb +5 -10
- data/lib/motion-rails-model/version.rb +1 -1
- metadata +2 -2
@@ -73,19 +73,14 @@ module RM
|
|
73
73
|
def connect(url, data, http_verb, &block)
|
74
74
|
BW::HTTP.send(http_verb, "#{@@url}#{url}", data) do |response|
|
75
75
|
if response.ok?
|
76
|
-
|
77
|
-
|
76
|
+
json = BW::JSON.parse(response.body.to_str)
|
77
|
+
if json.instance_of?(Array)
|
78
|
+
response.instance_variable_set(:@body, json.map {|y| self.class.new(y) })
|
78
79
|
else
|
79
|
-
|
80
|
-
if json.instance_of?(Array)
|
81
|
-
block.call(json.map {|y| self.class.new(y) })
|
82
|
-
else
|
83
|
-
block.call(self.class.new(json))
|
84
|
-
end
|
80
|
+
response.instance_variable_set(:@body, self.class.new(json))
|
85
81
|
end
|
86
|
-
else
|
87
|
-
block.call(nil)
|
88
82
|
end
|
83
|
+
block.call(response)
|
89
84
|
end
|
90
85
|
end
|
91
86
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-rails-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.4
|
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: 2012-
|
12
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bubble-wrap
|