wewoo 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9405068406bfb2b2a289835503acf38b8c41a13
4
- data.tar.gz: caddd5fad7db02dd7711fff21615bec5ae0ceb29
3
+ metadata.gz: ca2c71074d0a49510b9b19d342bd038d7f66930a
4
+ data.tar.gz: bf68fcde21277ac49343c7f9d1acce8256b31dd6
5
5
  SHA512:
6
- metadata.gz: 60c3603e885d9bab087e80053136bc37896b7a018a664da10e15b8f697f366e39e555f30e2da84e83a61606596504e14b88e65733b136fb67dbdc414c2de3703
7
- data.tar.gz: b8f56a6f2ef9892eaefe802cd3ad81cdd6dcbc9b603c3c4b4bc5479173817bc5c632706f37244e9dcdb6aa8f42505c1fdbbc67d5f13d05f7b4e0aa22a3d5ade1
6
+ metadata.gz: 75144191a050a06ae769dd44d2b677e5c10a44063f2514b32b5f71b703d7ff2eb14272e892bf0021f8bfa88116b55c8d3ce9bceb097989832e62e6fbfdb06f93
7
+ data.tar.gz: e4ad78a97121801d945987587e0709183aa0a7a4d6128b28c4b7548037fe86ee7eba443e96f9eaf30d85468091d45946e890bc73a34e3c7b22ecaf47f191969a
data/README.md CHANGED
@@ -162,6 +162,8 @@ g.q( "g.E.has( 'weight', T.lt, 0.5f)" ) #=> [e(1xSj-tve-2W) [113412-friend-11341
162
162
  * 0.1.3 Spec'ed out Gremlin API
163
163
  * 0.1.4 Refactor graph elements
164
164
  * 0.1.5 Beef up specs + README
165
+ * 0.1.6 Clean up
166
+ * 0.1.7 Added logger
165
167
 
166
168
  ## Contributing
167
169
 
@@ -29,11 +29,7 @@ module Wewoo
29
29
  return unless Configuration.debug
30
30
 
31
31
  msg = "[Wewoo] #{title} -- #{message}"
32
- if Object.const_defined? :Rails
33
- Rails.logger.info msg
34
- else
35
- puts msg
36
- end
32
+ logger.debug msg
37
33
  end
38
34
 
39
35
  def handle_response( resp )
@@ -54,5 +50,9 @@ module Wewoo
54
50
  results = body['results'] || body
55
51
  results.is_a?(Hash) ? Map[results] : results
56
52
  end
53
+
54
+ def logger
55
+ @logger ||= Logger.new( Configuration.log_file )
56
+ end
57
57
  end
58
58
  end
@@ -1,5 +1,9 @@
1
1
  module Wewoo
2
2
  class Configuration
3
+ def self.log_file(file=STDOUT)
4
+ @logger ||= file
5
+ end
6
+
3
7
  def self.debug(value=false)
4
8
  @debug ||= value
5
9
  end
@@ -112,6 +112,7 @@ module Wewoo
112
112
  find_first_vertex( :gid, gid )
113
113
  end
114
114
  def find_vertex( id )
115
+ raise "You must provide a valid vertex id" unless id
115
116
  Vertex.from_hash( self, get( u %W[vertices #{id}] ) )
116
117
  rescue InvalidRequestError => ex
117
118
  raise GraphElementNotFoundError, ex.message
@@ -162,6 +163,7 @@ module Wewoo
162
163
  end
163
164
 
164
165
  def find_edge( id )
166
+ raise "You must provide a valid edge id" unless id
165
167
  Edge.from_hash( self, get( u %W[edges #{id}] ) )
166
168
  rescue InvalidRequestError => ex
167
169
  raise GraphElementNotFoundError, ex.message
@@ -186,15 +188,6 @@ module Wewoo
186
188
  end
187
189
  alias :E :edges
188
190
 
189
- def to_s
190
- res = get( url, headers: { 'Content-Type' =>
191
- 'application/vnd.rexster-typed-v1+json' } )
192
- stats = res.graph.match( /.*\[vertices:(\d+) edges:(\d+)\]/ ).captures
193
-
194
- "#{name} [Vertices:#{stats.first}, Edges:#{stats.last}]"
195
- end
196
- alias inspect to_s
197
-
198
191
  private
199
192
 
200
193
  def map_value( value )
@@ -1,3 +1,3 @@
1
1
  module Wewoo
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wewoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - derailed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-28 00:00:00.000000000 Z
11
+ date: 2014-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus