aptible-auth 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/aptible-auth.gemspec +0 -1
- data/lib/aptible/auth/organization.rb +2 -36
- data/lib/aptible/auth/version.rb +1 -1
- data/spec/aptible/auth/organization_spec.rb +0 -32
- metadata +28 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d954656030591b55fe21defb1fb1c11b500916f3
|
4
|
+
data.tar.gz: 108efad6678ea2918ea08d75eac8d75eb5059daa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdb559e3a9911335c39f64acc4e61921f12fd08aa71e9bb5caa863a0f53840d990a429ac3b8de5607bd89866e209f24f016630631474277163e815f36d6048d7
|
7
|
+
data.tar.gz: 9556923f2322e7445e66c5e542a2632650cc53c7225baac606be18fcb709b06ef92bc93e6f660d88899d3d6ba6cc949634cc188aacaef01b7d49924df852b7a6
|
data/aptible-auth.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'stripe', '>= 1.13.0'
|
25
25
|
spec.add_dependency 'gem_config'
|
26
26
|
spec.add_dependency 'oauth2-aptible'
|
27
|
-
spec.add_dependency 'aptible-billforward'
|
28
27
|
|
29
28
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
30
29
|
spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'stripe'
|
2
2
|
require 'aptible/billing'
|
3
|
-
require 'aptible/billforward'
|
4
3
|
|
5
4
|
module Aptible
|
6
5
|
module Auth
|
@@ -9,7 +8,6 @@ module Aptible
|
|
9
8
|
has_many :users
|
10
9
|
has_many :invitations
|
11
10
|
belongs_to :security_officer
|
12
|
-
belongs_to :billing_contact
|
13
11
|
|
14
12
|
field :id
|
15
13
|
field :name
|
@@ -22,48 +20,16 @@ module Aptible
|
|
22
20
|
field :state
|
23
21
|
field :zip
|
24
22
|
field :address
|
25
|
-
field :stripe_customer_id
|
26
|
-
field :stripe_subscription_id
|
27
|
-
field :stripe_subscription_status
|
28
|
-
field :plan
|
29
23
|
field :security_alert_email
|
30
24
|
field :ops_alert_email
|
31
25
|
field :security_officer_id
|
32
|
-
field :billing_contact_id
|
33
|
-
field :billforward_account_id
|
34
26
|
|
35
|
-
def
|
36
|
-
|
37
|
-
@billforward_account ||= Aptible::BillForward::Account.find(
|
38
|
-
billforward_account_id
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
def stripe_customer
|
43
|
-
return nil if stripe_customer_id.nil?
|
44
|
-
@stripe_customer ||= Stripe::Customer.retrieve(stripe_customer_id)
|
45
|
-
end
|
46
|
-
|
47
|
-
def can_manage_compliance?
|
48
|
-
%w(production pilot).include?(billing_details.plan)
|
49
|
-
end
|
50
|
-
|
51
|
-
def billing_details
|
52
|
-
@billing_details ||= Aptible::Billing::BillingDetail.find(
|
27
|
+
def billing_detail
|
28
|
+
@billing_detail ||= Aptible::Billing::BillingDetail.find(
|
53
29
|
id, token: token, headers: headers
|
54
30
|
)
|
55
31
|
end
|
56
32
|
|
57
|
-
def subscription
|
58
|
-
return nil if stripe_subscription_id.nil?
|
59
|
-
subscriptions = stripe_customer.subscriptions
|
60
|
-
@subscription ||= subscriptions.retrieve(stripe_subscription_id)
|
61
|
-
end
|
62
|
-
|
63
|
-
def subscribed?
|
64
|
-
!!stripe_subscription_id
|
65
|
-
end
|
66
|
-
|
67
33
|
def privileged_roles
|
68
34
|
roles.select(&:privileged?)
|
69
35
|
end
|
data/lib/aptible/auth/version.rb
CHANGED
@@ -9,36 +9,4 @@ describe Aptible::Auth::Organization do
|
|
9
9
|
expect(subject.security_officer).to eq user
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
13
|
-
describe '#billing_contact' do
|
14
|
-
let(:user) { double 'Aptible::Auth::User' }
|
15
|
-
|
16
|
-
it 'should return the security officer' do
|
17
|
-
subject.stub(:billing_contact) { user }
|
18
|
-
expect(subject.billing_contact).to eq user
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#can_manage_compliance?' do
|
23
|
-
it 'should return true with compliance plan' do
|
24
|
-
subject.stub(:billing_details) { OpenStruct.new(plan: 'production') }
|
25
|
-
expect(subject.can_manage_compliance?).to be_true
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should return false without compliance plan' do
|
29
|
-
subject.stub(:billing_details) { OpenStruct.new(plan: 'platform') }
|
30
|
-
expect(subject.can_manage_compliance?).to be_false
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#subscribed?' do
|
35
|
-
it 'should return true with valid subscription ID' do
|
36
|
-
subject.stub(:stripe_subscription_id) { 'sub_4YrmiVa3vMpaGA' }
|
37
|
-
expect(subject.subscribed?).to be_true
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should return false without valid subscription ID' do
|
41
|
-
expect(subject.subscribed?).to be_false
|
42
|
-
end
|
43
|
-
end
|
44
12
|
end
|
metadata
CHANGED
@@ -1,167 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-billing
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aptible-resource
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.2.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.2.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: stripe
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.13.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.13.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gem_config
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: oauth2-aptible
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: aptible-billforward
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
80
|
+
- - '>='
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: bundler
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - ~>
|
102
88
|
- !ruby/object:Gem::Version
|
103
89
|
version: '1.3'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - ~>
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '1.3'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: aptible-tasks
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 0.2.0
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- -
|
108
|
+
- - '>='
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 0.2.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: rake
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - '>='
|
130
116
|
- !ruby/object:Gem::Version
|
131
117
|
version: '0'
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
|
-
- -
|
122
|
+
- - '>='
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: rspec
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- -
|
129
|
+
- - ~>
|
144
130
|
- !ruby/object:Gem::Version
|
145
131
|
version: '2.0'
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- -
|
136
|
+
- - ~>
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '2.0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: pry
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
|
-
- -
|
143
|
+
- - '>='
|
158
144
|
- !ruby/object:Gem::Version
|
159
145
|
version: '0'
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
|
-
- -
|
150
|
+
- - '>='
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: '0'
|
167
153
|
description: Ruby client for auth.aptible.com
|
@@ -171,9 +157,9 @@ executables: []
|
|
171
157
|
extensions: []
|
172
158
|
extra_rdoc_files: []
|
173
159
|
files:
|
174
|
-
-
|
175
|
-
-
|
176
|
-
-
|
160
|
+
- .gitignore
|
161
|
+
- .rspec
|
162
|
+
- .travis.yml
|
177
163
|
- Gemfile
|
178
164
|
- LICENSE.md
|
179
165
|
- Procfile
|
@@ -211,17 +197,17 @@ require_paths:
|
|
211
197
|
- lib
|
212
198
|
required_ruby_version: !ruby/object:Gem::Requirement
|
213
199
|
requirements:
|
214
|
-
- -
|
200
|
+
- - '>='
|
215
201
|
- !ruby/object:Gem::Version
|
216
202
|
version: '0'
|
217
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
204
|
requirements:
|
219
|
-
- -
|
205
|
+
- - '>='
|
220
206
|
- !ruby/object:Gem::Version
|
221
207
|
version: '0'
|
222
208
|
requirements: []
|
223
209
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.4.
|
210
|
+
rubygems_version: 2.4.5
|
225
211
|
signing_key:
|
226
212
|
specification_version: 4
|
227
213
|
summary: Ruby client for auth.aptible.com
|