accounts_client 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 ]
@@ -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
@@ -1,4 +1,4 @@
1
- # this module assumes base class has aa account_name attribute.
1
+ # this module assumes base class has an account_name attribute.
2
2
  module Accounts
3
3
  module BelongsToAccount
4
4
 
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.2
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-10-31 00:00:00.000000000 Z
12
+ date: 2012-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties