ey_services_fake 0.3.14 → 0.3.15

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.
@@ -46,6 +46,9 @@ module EyServicesFake
46
46
  end
47
47
  class Partner < Model
48
48
  has_many :Service, :services, :partner_id
49
+ def self.find_by_auth_id(auth_id)
50
+ first(:auth_id => auth_id)
51
+ end
49
52
  end
50
53
  class Service < Model
51
54
  has_many :ServiceEnablement, :service_enablements, :service_id
@@ -186,5 +186,27 @@ module EyServicesFake
186
186
  partner.auth_key)
187
187
  end
188
188
 
189
+ def provisioned_service_sso_url(service_account_id, app_deployment_id, sso_user, sso_account_id)
190
+ service_account = ServiceAccount.get(service_account_id)
191
+ partner = service_account.service.partner
192
+ provisioned_service = ProvisionedService.first(:app_deployment_id => app_deployment_id)
193
+ configuration_url = provisioned_service.configuration_url
194
+ params = {
195
+ 'timestamp' => Time.now.iso8601,
196
+ 'ey_user_id' => sso_user.external_service_id,
197
+ 'ey_user_name' => "Person Name",
198
+ 'ey_return_to_url' => "https://cloud.engineyard.com/dashboard",
199
+ 'access_level' => 'owner',
200
+ }
201
+ if service_account.users_url
202
+ params['ey_user_email'] = sso_user.email
203
+ end
204
+ require 'cgi'
205
+ EY::ApiHMAC::SSO.sign(configuration_url,
206
+ params,
207
+ partner.auth_id,
208
+ partner.auth_key)
209
+ end
210
+
189
211
  end
190
212
  end
@@ -15,6 +15,8 @@ module EyServicesFake
15
15
  # External API #
16
16
  ################
17
17
 
18
+ use EY::ApiHMAC::ApiAuth::Server, Partner
19
+
18
20
  get '/api/1/partners/:partner_id/services' do |partner_id|
19
21
  partner = Partner.get!(partner_id)
20
22
  to_return = []
@@ -1,3 +1,3 @@
1
1
  module EyServicesFake
2
- VERSION = "0.3.14"
2
+ VERSION = "0.3.15"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey_services_fake
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 14
10
- version: 0.3.14
9
+ - 15
10
+ version: 0.3.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jacob Burkhart & Josh Lane
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-06 00:00:00 Z
18
+ date: 2012-08-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: sinatra