cfoundry 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,8 @@ module CFoundry
22
22
  #
23
23
  # bearer (base64 ...)
24
24
  def token_data
25
+ return {} unless @token
26
+
25
27
  tok = Base64.decode64(@token.sub(/^bearer\s+/, ""))
26
28
  tok.sub!(/\{.+?\}/, "") # clear algo
27
29
  MultiJson.load(tok[/\{.+?\}/], :symbolize_keys => true)
@@ -52,10 +52,13 @@ module CFoundry::V2
52
52
  def create!
53
53
  payload = {}
54
54
 
55
+ @manifest ||= {}
56
+ @manifest[:entity] ||= {}
57
+
55
58
  self.class.defaults.merge(@manifest[:entity]).each do |k, v|
56
59
  if v.is_a?(Hash) && v.key?(:metadata)
57
60
  # skip; there's a _guid attribute already
58
- elsif v.is_a?(Array) && v.all? { |x|
61
+ elsif v.is_a?(Array) && !v.empty? && v.all? { |x|
59
62
  x.is_a?(Hash) && x.key?(:metadata)
60
63
  }
61
64
  singular = k.to_s.sub(/s$/, "")
@@ -22,9 +22,11 @@ module CFoundry::V2
22
22
  @guid
23
23
  end
24
24
 
25
+ alias set_guid_attribute guid=
26
+
25
27
  def guid=(x)
26
28
  @guid = x
27
- super
29
+ set_guid_attribute(x)
28
30
  end
29
31
 
30
32
  alias :admin? :admin
@@ -1,4 +1,4 @@
1
1
  module CFoundry # :nodoc:
2
2
  # CFoundry library version number.
3
- VERSION = "0.4.7".freeze
3
+ VERSION = "0.4.8".freeze
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfoundry
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 7
10
- version: 0.4.7
9
+ - 8
10
+ version: 0.4.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Suraci