csdn-tire 0.5 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tire/index.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  module Tire
3
3
  class Index
4
4
  include Utils
5
+ extend Utils
5
6
 
6
7
  attr_reader :name, :response
7
8
 
@@ -9,6 +10,21 @@ module Tire
9
10
  @name = name
10
11
  end
11
12
 
13
+ def self.list
14
+ url = "#{Configuration.url}/index"
15
+
16
+ @response = Configuration.client.get(url)
17
+ if @response.failure?
18
+ STDERR.puts "[REQUEST FAILED] \n"
19
+ raise @response.to_s
20
+ end
21
+
22
+ MultiJson.decode(@response.body)
23
+ ensure
24
+ curl = %Q|curl -X GET #{url}|
25
+ logged('Index list', curl)
26
+ end
27
+
12
28
  def url
13
29
  "#{Configuration.url}/#{@name}"
14
30
  end
data/lib/tire/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tire
3
- VERSION = "0.5"
3
+ VERSION = "0.5.1"
4
4
  end
@@ -51,6 +51,11 @@ module Tire
51
51
  assert @index.refresh
52
52
  end
53
53
 
54
+ should "get index list" do
55
+ @list = Tire::Index.list
56
+ assert_kind_of Array, @list
57
+ end
58
+
54
59
  end
55
60
 
56
61
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csdn-tire
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- version: "0.5"
9
+ - 1
10
+ version: 0.5.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Hooopo