aptible-rails 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77851e5b63d4ba6ad030de159a0467d6c9809d3f
4
- data.tar.gz: 85dccc170890ab8b4bbf5e9462e6eb26621c4f27
3
+ metadata.gz: 077945c2763d300c6ffa78be59b3dc4176223cc0
4
+ data.tar.gz: ec99d37daa03c53066674c192900d437107e8e33
5
5
  SHA512:
6
- metadata.gz: ac395bd98c88cc01fbf16b2db31ae47ff6a66c0bf5bd785aca990c74286aedd92c138a19dee035c3fc9d7da7797d84dd5f660dd35bf4b2b40c5e213f9f668cde
7
- data.tar.gz: 4902c73de66ec0e9845292587f0f71351fbf25991b1fa866c1c06c53c5c64a746308dafe9fae4269998082ed39db2cf264d32ab4c63dafbcb639f61cb218290f
6
+ metadata.gz: b8963c514e3419f5e7a8c18e38a149f6a3ad193f59ad5a70a7f5793509c1cd4b865008b05a0847702c181bbc47596ac380da3ecfbf00f841c2c1fab7e9fdc403
7
+ data.tar.gz: 58e85c52421f23c6b00c48354e3d1dac1354cd41fd8a537bffd2fadf77bb30292524c7306195d6d03c2d91066be4057de17c4f69ce86dc8ddc764dca9e00305e
@@ -28,11 +28,12 @@ module Aptible
28
28
  return @current_organization if @current_organization
29
29
  url = read_shared_cookie(:organization_url)
30
30
  @current_organization = Aptible::Auth::Organization.find_by_url(
31
- url, token: session_token
32
- ) if url
31
+ url, token: session_token) if url
32
+ @current_organization ||= default_organization
33
+
33
34
  rescue HyperResource::ClientError => e
34
35
  raise e unless e.body['code'] == 403
35
- set_default_organization
36
+ @current_organization = default_organization
36
37
  end
37
38
 
38
39
  def current_organization=(organization)
@@ -43,8 +44,7 @@ module Aptible
43
44
  token_subject || session_subject
44
45
  end
45
46
 
46
- # before_action :set_default_organization
47
- def set_default_organization
47
+ def default_organization
48
48
  return @current_organization if @current_organization
49
49
  orgs = Aptible::Auth::Organization.all(token: session_token)
50
50
  self.current_organization = orgs.first if orgs.any?
@@ -17,4 +17,10 @@ class ResourceDecorator < ApplicationDecorator
17
17
  return nil unless object.last_operation
18
18
  @last_operation ||= OperationDecorator.decorate(object.last_operation)
19
19
  end
20
+
21
+ def operation_count
22
+ garner.bind(h.controller.session_token).bind(object) do
23
+ object.operations.count
24
+ end
25
+ end
20
26
  end
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Rails
3
- VERSION = '0.6.8'
3
+ VERSION = '0.6.9'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-03 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config