motion-rails-model 0.0.1.3 → 0.0.1.4

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.
@@ -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
- if response.body.nil?
77
- block.call(response.status_code)
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
- json = BW::JSON.parse(response.body.to_str)
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
 
@@ -1,5 +1,5 @@
1
1
  module RM
2
2
  class Model
3
- VERSION = "0.0.1.3"
3
+ VERSION = "0.0.1.4"
4
4
  end
5
5
  end
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.3
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-09-28 00:00:00.000000000 Z
12
+ date: 2012-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bubble-wrap