woopy 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/woopy/account.rb CHANGED
@@ -12,6 +12,10 @@ module Woopy
12
12
  Ownership.create(account_id: self.id, user_id: user.id, role: role)
13
13
  end
14
14
 
15
+ def employments
16
+ Employment.find(:all, params: {account_id: self.id} )
17
+ end
18
+
15
19
  def find_employment(user)
16
20
  employment_json = Account.get("#{self.id}/users/#{user.id}/employment")
17
21
 
data/lib/woopy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Woopy
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -36,6 +36,10 @@ def user_attributes
36
36
  { name: "User Name", email: "user@example.com" }
37
37
  end
38
38
 
39
+ def employment_collection_response
40
+ { employments: [employment_attributes.merge(id: 1)] }.to_json
41
+ end
42
+
39
43
  def employment_response
40
44
  { employment: employment_attributes.merge(id: 1) }.to_json
41
45
  end
@@ -11,6 +11,7 @@ describe Woopy::Account do
11
11
  mock.post( '/services/v1/ownerships.json', request_headers(@token), ownership_response )
12
12
 
13
13
  mock.get( '/services/v1/accounts/1/users/1/employment.json', accept_request_headers(@token), employment_response )
14
+ mock.get( '/services/v1/accounts/1/employments.json', accept_request_headers(@token), employment_collection_response )
14
15
  mock.post( '/services/v1/accounts/1/employments.json', request_headers(@token), employment_response )
15
16
  mock.delete( '/services/v1/accounts/1/employments/1.json', accept_request_headers(@token), employment_response )
16
17
 
@@ -74,4 +75,25 @@ describe Woopy::Account do
74
75
  end
75
76
 
76
77
  end
78
+
79
+ context "#employments" do
80
+ context "users on account" do
81
+ before do
82
+ @account = Woopy::Account.create(account_attributes)
83
+ @employments = add_users_to_account(@account)
84
+ end
85
+
86
+ subject { @account.employments }
87
+
88
+ it { should == @employments }
89
+ end
90
+ end
91
+
92
+ def add_users_to_account(account)
93
+ employments = []
94
+ user = Woopy::User.create(user_attributes)
95
+ employment = account.employ(user)
96
+ employments << employment
97
+ employments
98
+ end
77
99
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woopy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-22 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70136584535640 !ruby/object:Gem::Requirement
16
+ requirement: &70252137852780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70136584535640
24
+ version_requirements: *70252137852780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70136584535140 !ruby/object:Gem::Requirement
27
+ requirement: &70252137852280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.8'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70136584535140
35
+ version_requirements: *70252137852280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70136584534720 !ruby/object:Gem::Requirement
38
+ requirement: &70252137851860 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70136584534720
46
+ version_requirements: *70252137851860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: gem-release
49
- requirement: &70136584534260 !ruby/object:Gem::Requirement
49
+ requirement: &70252137851400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70136584534260
57
+ version_requirements: *70252137851400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activeresource
60
- requirement: &70136584533760 !ruby/object:Gem::Requirement
60
+ requirement: &70252137850900 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '3.1'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70136584533760
68
+ version_requirements: *70252137850900
69
69
  description: Wraps the Woople API as ActiveResources
70
70
  email:
71
71
  - developers@bigbangtechnology.com