LVS-JSONService 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.specification +1 -1
- data/JSONService.gemspec +1 -1
- data/VERSION +1 -1
- data/lib/lvs/json_service/base.rb +15 -3
- metadata +1 -1
data/.specification
CHANGED
data/JSONService.gemspec
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -133,7 +133,7 @@ module LVS
|
|
133
133
|
|
134
134
|
def parse_result(response)
|
135
135
|
if response.is_a?(Array)
|
136
|
-
response.map { |x| self.new(x) }
|
136
|
+
array = response.map { |x| self.new(x) }
|
137
137
|
else
|
138
138
|
self.new(response)
|
139
139
|
end
|
@@ -143,6 +143,7 @@ module LVS
|
|
143
143
|
|
144
144
|
def initialize(values = {})
|
145
145
|
@data = values
|
146
|
+
@manually_set = {}
|
146
147
|
end
|
147
148
|
|
148
149
|
def id
|
@@ -169,14 +170,17 @@ module LVS
|
|
169
170
|
key = name_to_key(name)
|
170
171
|
value = @data[key]
|
171
172
|
if name =~ /=$/
|
172
|
-
@data[key] = args[0]
|
173
|
+
@data[key] = ManuallySetData.new(args[0])
|
174
|
+
value = @data[key]
|
173
175
|
elsif name =~ /\?$/
|
174
176
|
value = @data[name_to_key("has_#{key}")]
|
175
177
|
!(value == 0 || value.blank?)
|
176
178
|
elsif name =~ /^has_/
|
177
179
|
!(value == 0 || value.blank?)
|
178
180
|
else
|
179
|
-
if (value.is_a?(
|
181
|
+
if (value.is_a?(ManuallySetData))
|
182
|
+
value = value.data
|
183
|
+
elsif (value.is_a?(Hash))
|
180
184
|
value = self.class.new(value)
|
181
185
|
elsif (value.is_a?(Array))
|
182
186
|
value = value.collect {|v| if v.is_a?(Hash) or v.is_a?(Array) then self.class.new(v) else v end }
|
@@ -196,6 +200,14 @@ module LVS
|
|
196
200
|
end
|
197
201
|
end
|
198
202
|
|
203
|
+
class ManuallySetData
|
204
|
+
attr_reader :data
|
205
|
+
|
206
|
+
def initialize(value)
|
207
|
+
@data = value
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
199
211
|
class Error < StandardError
|
200
212
|
attr_reader :message, :code, :service, :args, :json_response
|
201
213
|
|