accounts_client 0.0.2 → 0.0.3
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.
- data/app/models/padma_account.rb +1 -1
- data/app/models/padma_user.rb +13 -1
- data/lib/accounts/belongs_to_account.rb +1 -1
- metadata +2 -2
data/app/models/padma_account.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Configuration for LogicalModel on /config/initializers/logical_model.rb
|
3
3
|
class PadmaAccount < LogicalModel
|
4
4
|
self.hydra = Accounts::HYDRA
|
5
|
-
self.use_ssl = (Rails.env=="production")
|
5
|
+
self.use_ssl = (defined?(Rails)? Rails.env=="production" : ENV['RACK_ENV']=='production')
|
6
6
|
|
7
7
|
self.resource_path = "/v0/accounts"
|
8
8
|
self.attribute_keys = [:id, :name, :enabled ]
|
data/app/models/padma_user.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class PadmaUser < LogicalModel
|
2
2
|
self.hydra = Accounts::HYDRA
|
3
|
-
self.use_ssl = (Rails.env=="production")
|
3
|
+
self.use_ssl = (defined?(Rails)? Rails.env=="production" : ENV['RACK_ENV']=='production')
|
4
4
|
|
5
5
|
self.resource_path = "/v0/users"
|
6
6
|
self.attribute_keys = [:username,
|
@@ -24,6 +24,18 @@ class PadmaUser < LogicalModel
|
|
24
24
|
self.username
|
25
25
|
end
|
26
26
|
|
27
|
+
# @return [PadmaAccount]
|
28
|
+
def current_account
|
29
|
+
unless cached_current_account
|
30
|
+
if self.current_account_name
|
31
|
+
self.cached_current_account= PadmaAccount.find(self.current_account_name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
cached_current_account
|
35
|
+
end
|
36
|
+
attr_accessor :cached_current_account
|
37
|
+
|
38
|
+
|
27
39
|
# Returns my accounts as Padma::Account objects
|
28
40
|
# @return [Array <PadmaAccount>]
|
29
41
|
def padma_accounts
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accounts_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2012-
|
12
|
+
date: 2012-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|