sdb_service 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,20 +3,14 @@ module SdbService
3
3
 
4
4
  def initialize(data)
5
5
  @payload = data
6
- @transformed_payload = nil
7
- @valid = true
8
6
  end
9
7
 
10
8
  def serialize!
11
- @transformed_payload = serialize_payload(@payload) rescue @payload
9
+ serialize_payload(@payload) rescue @payload
12
10
  end
13
11
 
14
12
  def deserialize!
15
- @transformed_payload = deserialize_payload(@payload) rescue @payload
16
- end
17
-
18
- def to_s
19
- @transformed_payload
13
+ deserialize_payload(@payload) rescue @payload
20
14
  end
21
15
 
22
16
  # these methods should be overriden by the strategy that subclasses the Serializer class.
@@ -5,11 +5,11 @@ module SdbService
5
5
  class JsonSerializer < Serializer
6
6
 
7
7
  def serialize_payload(payload)
8
- JSON.generate(payload)
8
+ payload.is_a?(String) ? payload : JSON.generate(payload)
9
9
  end
10
10
 
11
11
  def deserialize_payload(payload)
12
- JSON.parse(payload)
12
+ payload.is_a?(String) ? payload : JSON.parse(payload)
13
13
  end
14
14
 
15
15
  end
@@ -40,7 +40,7 @@ module SdbService
40
40
  if raw_payload.nil?
41
41
  data = _parse(data_payload) do |value|
42
42
  serializer_result = serializer.new(value)
43
- serializer_result.serialize!.to_s
43
+ serializer_result.serialize!
44
44
  end
45
45
  data["mime_type"] = "text/#{self.serializer_format}"
46
46
  else
@@ -74,7 +74,7 @@ module SdbService
74
74
  end
75
75
 
76
76
  def query!(statement)
77
- stmt = statement.nil? ? "" : "[#{statement}]"
77
+ stmt = statement.nil? ? "" : statement
78
78
  data_store.query(self.database, stmt)
79
79
  end
80
80
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 3
9
- version: 0.3.3
8
+ - 4
9
+ version: 0.3.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Derek Perez
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-12 00:00:00 -07:00
17
+ date: 2010-05-13 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency