ey-core 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -108,6 +108,7 @@ class Ey::Core::Client::Mock
108
108
  {
109
109
  :account_referrals => {},
110
110
  :accounts => {},
111
+ :account_trials => {},
111
112
  :addons => {},
112
113
  :addresses => {},
113
114
  :agents => {},
@@ -205,6 +206,14 @@ class Ey::Core::Client::Mock
205
206
  found
206
207
  end
207
208
 
209
+ @current_user ||= begin
210
+ _,token = self.data[:tokens].detect{|k,v| v["auth_id"] == options[:token]}
211
+ if token
212
+ user_id = token["on_behalf_of"].split("/").last
213
+ self.data[:users][user_id]
214
+ end
215
+ end
216
+
208
217
  # FIXME(rs) get rid of this and the implicit Josh Lane creation entirely
209
218
  @current_user ||= begin
210
219
  _,found = self.data[:users].detect{|k,v| v["email"] == "jlane@engineyard.com"}
@@ -14,13 +14,14 @@ class Ey::Core::Client
14
14
 
15
15
  find(:accounts, account_id)
16
16
 
17
- resource = {
17
+ resource = self.data[:account_trials][account_id]
18
+ resource ||= {
18
19
  "id" => Cistern::Mock.random_numbers(4),
19
20
  "duration" => 500,
20
21
  "used" => 30,
21
22
  "created_at" => Time.now.to_s,
22
- "account" => url_for("/accounts/#{account_id}")
23
23
  }
24
+ resource["account"] = url_for("/accounts/#{account_id}")
24
25
 
25
26
  response(
26
27
  :body => {"account_trial" => resource},
@@ -1,5 +1,5 @@
1
1
  module Ey
2
2
  module Core
3
- VERSION = "3.1.4"
3
+ VERSION = "3.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.5
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: 2016-06-23 00:00:00.000000000 Z
12
+ date: 2016-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable