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 CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LVS-JSONService
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  require_paths:
6
6
  - lib
7
7
  platform: ruby
data/JSONService.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{JSONService}
5
- s.version = "0.2.9"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["LVS"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
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?(Hash))
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LVS-JSONService
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LVS