woopy 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,12 +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
-
19
15
  def find_employment(user)
20
- Employment.find(:first, params: { account_id: self.id, user_id: user.id})
16
+ employment_json = Account.get("#{self.id}/users/#{user.id}/employment")
17
+
18
+ Employment.new(employment_json, true)
21
19
  end
22
20
  end
23
- end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Woopy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -28,23 +28,6 @@ def account_attributes
28
28
  { name: "Account", subdomain: "subdomain1", packages: ["package1", "package2"] }
29
29
  end
30
30
 
31
- def user_account_employment_response
32
- {
33
- employments: [
34
- { employment: employment_attributes.merge(id: 1) }
35
- ]
36
- }.to_json
37
- end
38
-
39
- def account_employments_response
40
- {
41
- employments: [
42
- { employment: employment_attributes.merge(id: 1) },
43
- { employment: employment_attributes.merge(id: 2, user_id: 2,) }
44
- ]
45
- }.to_json
46
- end
47
-
48
31
  def user_response
49
32
  { user: user_attributes.merge(id: 1) }.to_json
50
33
  end
@@ -10,8 +10,7 @@ describe Woopy::Account do
10
10
  mock.post( '/services/v1/users.json', request_headers(@token), user_response )
11
11
  mock.post( '/services/v1/ownerships.json', request_headers(@token), ownership_response )
12
12
 
13
- mock.get( '/services/v1/accounts/1/employments.json', accept_request_headers(@token), account_employments_response )
14
- mock.get( '/services/v1/accounts/1/employments.json?user_id=1', accept_request_headers(@token), user_account_employment_response )
13
+ mock.get( '/services/v1/accounts/1/users/1/employment.json', accept_request_headers(@token), employment_response )
15
14
  mock.post( '/services/v1/accounts/1/employments.json', request_headers(@token), employment_response )
16
15
  mock.delete( '/services/v1/accounts/1/employments/1.json', accept_request_headers(@token), employment_response )
17
16
  end
@@ -58,16 +57,11 @@ describe Woopy::Account do
58
57
  it { should be_persisted }
59
58
  end
60
59
 
61
- describe "#employments" do
62
- subject { @account.employments }
63
-
64
- its(:count) { should == 2 }
65
- end
66
-
67
60
  describe "#find_employment" do
68
61
  subject { @account.find_employment(@user) }
69
62
 
70
63
  it { should be_kind_of Woopy::Employment }
64
+ it { should be_persisted }
71
65
  its(:user_id) { should == @user.id }
72
66
  end
73
67
  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.0
4
+ version: 0.2.1
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-02-16 00:00:00.000000000 Z
12
+ date: 2012-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70137251115060 !ruby/object:Gem::Requirement
16
+ requirement: &70327883433640 !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: *70137251115060
24
+ version_requirements: *70327883433640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70137251114540 !ruby/object:Gem::Requirement
27
+ requirement: &70327883432480 !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: *70137251114540
35
+ version_requirements: *70327883432480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70137251114120 !ruby/object:Gem::Requirement
38
+ requirement: &70327883431080 !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: *70137251114120
46
+ version_requirements: *70327883431080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: gem-release
49
- requirement: &70137251113660 !ruby/object:Gem::Requirement
49
+ requirement: &70327883280420 !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: *70137251113660
57
+ version_requirements: *70327883280420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activeresource
60
- requirement: &70137251113160 !ruby/object:Gem::Requirement
60
+ requirement: &70327883278720 !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: *70137251113160
68
+ version_requirements: *70327883278720
69
69
  description: Wraps the Woople API as ActiveResources
70
70
  email:
71
71
  - developers@bigbangtechnology.com
@@ -104,15 +104,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  - - ! '>='
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
+ segments:
108
+ - 0
109
+ hash: -1435565781307241770
107
110
  required_rubygems_version: !ruby/object:Gem::Requirement
108
111
  none: false
109
112
  requirements:
110
113
  - - ! '>='
111
114
  - !ruby/object:Gem::Version
112
115
  version: '0'
116
+ segments:
117
+ - 0
118
+ hash: -1435565781307241770
113
119
  requirements: []
114
120
  rubyforge_project: woopy
115
- rubygems_version: 1.8.15
121
+ rubygems_version: 1.8.10
116
122
  signing_key:
117
123
  specification_version: 3
118
124
  summary: Woople API Wrapper