medea 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -113,39 +113,29 @@ module Medea
113
113
  def execute_query content=true
114
114
  #hit the URL
115
115
  #fill self.contents with :ghost versions of JasonObjects
116
- begin
117
- LOGGER.debug "Executing #{type.name} deferred query! (#{to_url})"
116
+ LOGGER.debug "Executing #{type.name} deferred query! (#{to_url})"
118
117
 
119
- response = RestClient.get to_url
120
- result = JSON.parse(response)
121
- self.contents = []
122
- #results are in a hash, their keys are just numbers
123
- result.keys.each do |k|
124
- if k =~ /^[0-9]+$/
125
- #this is a result! get the key
126
- item = type.new(result[k]["HTTP_X_KEY"], :lazy)
127
- if content && result[k].has_key?("CONTENT") && result[k]["CONTENT"] != ""
128
- item.instance_variable_set(:@__jason_data, result[k]["CONTENT"])
129
- item.instance_variable_set(:@__jason_state, :stale)
130
- end
131
- if result[k].has_key?("HTTP_X_PARENT") && result[k]["HTTP_X_PARENT"] != ""
132
- item.jason_parent_key = result[k]["HTTP_X_PARENT"]
133
- end
134
- self.contents << item
118
+ response = RestClient.get to_url
119
+ result = JSON.parse(response)
120
+ self.contents = []
121
+ #results are in a hash, their keys are just numbers
122
+ result.keys.each do |k|
123
+ if k =~ /^[0-9]+$/
124
+ #this is a result! get the key
125
+ item = type.new(result[k]["HTTP_X_KEY"], :lazy)
126
+ if content && result[k].has_key?("CONTENT") && result[k]["CONTENT"] != ""
127
+ item.instance_variable_set(:@__jason_data, result[k]["CONTENT"])
128
+ item.instance_variable_set(:@__jason_state, :stale)
135
129
  end
130
+ if result[k].has_key?("HTTP_X_PARENT") && result[k]["HTTP_X_PARENT"] != ""
131
+ item.jason_parent_key = result[k]["HTTP_X_PARENT"]
132
+ end
133
+ self.contents << item
136
134
  end
137
-
138
- self.state = :postfetch
139
- result
140
- rescue
141
- if response.code != 200
142
- LOGGER.error "Query to #{to_url} failed to parse!"
143
- else
144
- LOGGER.error "Query to #{to_url} failed to get!"
145
- end
146
-
147
- self.contents = []
148
135
  end
136
+
137
+ self.state = :postfetch
138
+ result
149
139
  end
150
140
  end
151
141
  end
data/lib/medea/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Medea
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medea
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Jensen