spire_io 1.0.0.beta.2 → 1.0.0.beta.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/lib/spire/api/session.rb +24 -30
- metadata +6 -6
data/lib/spire/api/session.rb
CHANGED
@@ -127,38 +127,32 @@ class Spire
|
|
127
127
|
@channels ||= channels!
|
128
128
|
end
|
129
129
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
#}
|
140
|
-
#end
|
141
|
-
|
142
|
-
def subscriptions
|
143
|
-
if @subscriptions
|
144
|
-
@subscriptions
|
145
|
-
else
|
146
|
-
# TODO Fix this to use an API call once Spire supports it
|
147
|
-
@subscriptions = {}
|
148
|
-
channels.each do |name, channel|
|
149
|
-
if subs = channel.properties["subscriptions"]
|
150
|
-
subs.each do |key, sub|
|
151
|
-
@subscriptions[key] = API::Subscription.new(@spire, sub)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
@subscriptions
|
156
|
-
end
|
130
|
+
define_request(:subscriptions) do
|
131
|
+
{
|
132
|
+
:method => :get,
|
133
|
+
:url => @resources["subscriptions"]["url"],
|
134
|
+
:headers => {
|
135
|
+
"Authorization" => "Capability #{@resources["subscriptions"]["capability"]}",
|
136
|
+
"Accept" => @spire.mediaType("subscriptions"),
|
137
|
+
}
|
138
|
+
}
|
157
139
|
end
|
158
140
|
|
159
|
-
|
160
|
-
|
161
|
-
|
141
|
+
def subscriptions
|
142
|
+
@subscriptions ||= subscriptions!
|
143
|
+
end
|
144
|
+
|
145
|
+
def subscriptions!
|
146
|
+
response = request(:subscriptions)
|
147
|
+
unless response.status == 200
|
148
|
+
raise "Error retrieving Subscriptions: (#{response.status}) #{response.body}"
|
149
|
+
end
|
150
|
+
@subscriptions = {}
|
151
|
+
response.data.each do |name, properties|
|
152
|
+
@subscriptions[name] = API::Subscription.new(@spire, properties)
|
153
|
+
end
|
154
|
+
@subscriptions
|
155
|
+
end
|
162
156
|
|
163
157
|
end
|
164
158
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spire_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3899554913
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 1.0.0.beta.
|
11
|
+
- 3
|
12
|
+
version: 1.0.0.beta.3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Dan Yoder
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-02-
|
22
|
+
date: 2012-02-03 00:00:00 -08:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
requirements: []
|
152
152
|
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 1.
|
154
|
+
rubygems_version: 1.6.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 3
|
157
157
|
summary: Ruby client for spire.io
|