cocupu 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/cocupu.rb +2 -1
  3. data/spec/unit/cocupu_spec.rb +13 -1
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'httmultiparty'
4
4
  require 'cocupu/identity'
5
+ require 'cocupu/pool'
5
6
  require 'cocupu/model'
6
7
  require 'cocupu/node'
7
8
  require 'cocupu/file'
@@ -39,7 +40,7 @@ module Cocupu
39
40
  return @identities if @identities
40
41
  response = self.class.get("http://#{host}:#{port}/identities?auth_token=#{token}")
41
42
  raise "Error getting identities: #{response}" unless response.code == 200
42
- @identities = response.map {|val| Identity.new(val, self)}
43
+ @identities = response.map {|val| Identity.new(val)}
43
44
  end
44
45
 
45
46
  def identity(short_name)
@@ -4,11 +4,23 @@ describe Cocupu do
4
4
 
5
5
  before do
6
6
  FakeWeb.register_uri(:post, "http://localhost:3001/api/v1/tokens", :body => "{\"token\":\"112312\"}", :content_type => "text/json")
7
- Cocupu.start('justin@cocupu.com', 'password', 3001, 'localhost')
7
+ @conn = Cocupu.start('justin@cocupu.com', 'password', 3001, 'localhost')
8
8
  @identity = 'my_id'
9
9
  @pool = 'my_pool'
10
10
  end
11
11
 
12
+ describe "get pool list" do
13
+ before do
14
+ FakeWeb.register_uri(:get, "http://localhost:3001/identities?auth_token=112312", :body=>"[{\"url\":\"/identity/1234\",\"short_name\":\"fred\"},{\"url\":\"/identity/5677\",\"short_name\":\"my_id\"}]", :content_type => "text/json")
15
+ FakeWeb.register_uri(:get, "http://localhost:3001/identity/5677.json?auth_token=112312", :body=>"[{\"short_name\":\"kiddy_pool\"}]", :content_type => "text/json")
16
+ end
17
+ it "should be successful" do
18
+ pools = @conn.identity('my_id').pools
19
+ pools.size.should == 1
20
+ pools.first.short_name.should == 'kiddy_pool'
21
+ end
22
+ end
23
+
12
24
  describe "creating a new model" do
13
25
  before do
14
26
  FakeWeb.register_uri(:post, 'http://localhost:3001/my_id/my_pool/models.json?auth_token=112312', :body=>'{"id":"99"}', :content_type=>"text/json")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocupu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-05 00:00:00.000000000 Z
12
+ date: 2012-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httmultiparty