medea 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/medea.rb CHANGED
@@ -8,4 +8,11 @@ module Medea
8
8
  require 'medea/jasondeferredquery'
9
9
  require 'medea/jasonlistproperty'
10
10
  require 'medea/jasondb'
11
+
12
+ if defined?(Rails)
13
+ LOGGER = Rails.logger
14
+ else
15
+ require 'medea/dummy_logger'
16
+ LOGGER = DummyLogger.new
17
+ end
11
18
  end
@@ -0,0 +1,21 @@
1
+ class DummyLogger
2
+ def debug *args
3
+
4
+ end
5
+
6
+ def info *args
7
+
8
+ end
9
+
10
+ def warn *args
11
+
12
+ end
13
+
14
+ def error *args
15
+
16
+ end
17
+
18
+ def fatal *args
19
+
20
+ end
21
+ end
@@ -114,8 +114,10 @@ module Medea
114
114
  #hit the URL
115
115
  #fill self.contents with :ghost versions of JasonObjects
116
116
  begin
117
- #puts " = Executing #{type.name} deferred query! (#{to_url})"
118
- result = JSON.parse(RestClient.get to_url)
117
+ LOGGER.debug "Executing #{type.name} deferred query! (#{to_url})"
118
+
119
+ response = RestClient.get to_url
120
+ result = JSON.parse(response)
119
121
  self.contents = []
120
122
  #results are in a hash, their keys are just numbers
121
123
  result.keys.each do |k|
@@ -136,6 +138,12 @@ module Medea
136
138
  self.state = :postfetch
137
139
  result
138
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
+
139
147
  self.contents = []
140
148
  end
141
149
  end
data/lib/medea/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Medea
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Jensen
@@ -91,6 +91,7 @@ files:
91
91
  - index.html
92
92
  - lib/medea.rb
93
93
  - lib/medea/active_model_methods.rb
94
+ - lib/medea/dummy_logger.rb
94
95
  - lib/medea/inheritable_attributes.rb
95
96
  - lib/medea/jasondb.rb
96
97
  - lib/medea/jasondeferredquery.rb