cfoundry 0.3.51 → 0.3.52

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,7 +41,7 @@ module CFoundry
41
41
 
42
42
  def parse_json(x)
43
43
  if x.empty?
44
- raise MultiJson::DecodeError, "Empty JSON string", [], ""
44
+ raise MultiJson::DecodeError.new("Empty JSON string", [], "")
45
45
  else
46
46
  MultiJson.load(x, :symbolize_keys => true)
47
47
  end
@@ -111,7 +111,7 @@ module CFoundry::V2
111
111
  route = @client.route
112
112
  route.host = host
113
113
  route.domain = domain
114
- route.organization = @client.current_organization
114
+ route.space = space
115
115
  route.create!
116
116
  end
117
117
 
@@ -186,7 +186,7 @@ module CFoundry::V2
186
186
  "[%s] %0.3fs %s %6s -> %d %s\n",
187
187
  Time.now.strftime("%F %T"),
188
188
  data[:time],
189
- data[:response][:headers][:x_vcap_request_id],
189
+ data[:response][:headers]["x-vcap-request-id"],
190
190
  data[:request][:method].to_s.upcase,
191
191
  data[:response][:code],
192
192
  data[:request][:url])
@@ -4,8 +4,9 @@ module CFoundry::V2
4
4
  class Domain < Model
5
5
  attribute :name, :string
6
6
  attribute :wildcard, :boolean, :default => true
7
- to_one :owning_organization, :as => :organization
7
+ to_one :owning_organization, :as => :organization, :default => nil
8
8
 
9
- scoped_to_organization :owning_organization
9
+ # hide wildcard support for now
10
+ private :wildcard=
10
11
  end
11
12
  end
@@ -78,11 +78,19 @@ module CFoundry::V2
78
78
  $1 + $2.upcase
79
79
  end
80
80
 
81
+ default = opts[:default]
82
+
83
+ if has_default = opts.key?(:default)
84
+ defaults[:"#{name}_guid"] = default
85
+ end
86
+
81
87
  define_method(name) {
82
88
  if @manifest && @manifest[:entity].key?(name)
83
89
  @client.send(:"make_#{obj}", @manifest[:entity][name])
84
90
  elsif url = send("#{name}_url")
85
91
  @client.send(:"#{obj}_from", url, opts[:depth] || 1)
92
+ else
93
+ default
86
94
  end
87
95
  }
88
96
 
@@ -91,12 +99,14 @@ module CFoundry::V2
91
99
  }
92
100
 
93
101
  define_method(:"#{name}=") { |x|
94
- Model.validate_type(x, CFoundry::V2.const_get(kls))
102
+ unless has_default && x == default
103
+ Model.validate_type(x, CFoundry::V2.const_get(kls))
104
+ end
95
105
 
96
106
  @manifest ||= {}
97
107
  @manifest[:entity] ||= {}
98
108
  @manifest[:entity][:"#{name}_guid"] =
99
- @diff[:"#{name}_guid"] = x.guid
109
+ @diff[:"#{name}_guid"] = x && x.guid
100
110
  }
101
111
  end
102
112
 
@@ -4,7 +4,7 @@ module CFoundry::V2
4
4
  class Route < Model
5
5
  attribute :host, :string
6
6
  to_one :domain
7
- to_one :organization
7
+ to_one :space
8
8
 
9
9
  def name
10
10
  "#{host}.#{domain.name}"
@@ -1,4 +1,4 @@
1
1
  module CFoundry # :nodoc:
2
2
  # CFoundry library version number.
3
- VERSION = "0.3.51"
3
+ VERSION = "0.3.52"
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: 117
4
+ hash: 123
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 51
10
- version: 0.3.51
9
+ - 52
10
+ version: 0.3.52
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Suraci
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-01 00:00:00 Z
18
+ date: 2012-11-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: multipart-post