carbonculture 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +8 -0
- data/carbonculture.gemspec +28 -0
- data/lib/carbonculture/base_url.rb +3 -0
- data/lib/carbonculture/channel.rb +56 -0
- data/lib/carbonculture/organisation.rb +26 -0
- data/lib/carbonculture/place.rb +32 -0
- data/lib/carbonculture/result.rb +12 -0
- data/lib/carbonculture/version.rb +3 -0
- data/lib/carbonculture.rb +7 -0
- data/spec/fixtures/carbonculture_cassettes/channel.yml +313 -0
- data/spec/fixtures/carbonculture_cassettes/organisation.yml +133 -0
- data/spec/fixtures/carbonculture_cassettes/place.yml +529 -0
- data/spec/lib/carbonculture/base_url_spec.rb +7 -0
- data/spec/lib/carbonculture/channel_spec.rb +75 -0
- data/spec/lib/carbonculture/organisation_spec.rb +59 -0
- data/spec/lib/carbonculture/place_spec.rb +73 -0
- data/spec/lib/carbonculture/result_spec.rb +0 -0
- data/spec/spec_helper.rb +10 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3821fca3c7b630be4de6b2e4d22c4067cbcefbaf
|
4
|
+
data.tar.gz: eff2621b87a3f9257e671abcc7b0037c3d247a7c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f42abd2b64c7d2266732b9e8bb5d866c55988d15c690337083e702a36e661a5012deab9f0ef3f4a07e9703ffacc10a1b29a4a20bfc8638f286f1684236660f5b
|
7
|
+
data.tar.gz: 5e356620c9f7c27d3a10ffa20cabda4a08a44c88b746e8afdde296d2525634781ac2ac4e8c16ffe25e1ed1924e0008e17ea4de912b811e96e8d3555d7996323b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Sam Knight
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Carbonculture
|
2
|
+
|
3
|
+
Reads the utility usage of various public buildings including Number 10 Downing Street
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'carbonculture'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install carbonculture
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
You can find building from organisations or call it directly.
|
22
|
+
|
23
|
+
Carbonculture::Organisation('number10').places
|
24
|
+
|
25
|
+
or
|
26
|
+
|
27
|
+
Carbonculture::Place('10-downing-street', 'number10')
|
28
|
+
|
29
|
+
Channels for different types of utility (electric, gas, etc)
|
30
|
+
|
31
|
+
Carbonculture::Place('10-downing-street', 'number10').channels
|
32
|
+
|
33
|
+
More information on methods and results available can be discovered at http://data.carbonculture.net/
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'carbonculture/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "carbonculture"
|
8
|
+
spec.version = Carbonculture::VERSION
|
9
|
+
spec.authors = ["Sam Knight"]
|
10
|
+
spec.email = ["sam@samknight.co.uk"]
|
11
|
+
spec.description = "Ruby library to gather energy data from CarbonCulture"
|
12
|
+
spec.summary = "Ruby library to gather energy data from CarbonCulture"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'httparty'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'minitest'
|
24
|
+
spec.add_development_dependency 'webmock'
|
25
|
+
spec.add_development_dependency 'vcr'
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Carbonculture
|
2
|
+
class Channel
|
3
|
+
include HTTParty
|
4
|
+
attr_accessor :name, :place_name, :organisation_name, :data, :body, :results
|
5
|
+
|
6
|
+
def initialize(name, place_name, organisation_name, options = {})
|
7
|
+
self.name = name
|
8
|
+
self.place_name = place_name
|
9
|
+
self.organisation_name = organisation_name
|
10
|
+
self.results = []
|
11
|
+
|
12
|
+
call_api(options)
|
13
|
+
|
14
|
+
begin
|
15
|
+
self.body = JSON.parse(self.data.body)
|
16
|
+
rescue
|
17
|
+
raise ArgumentError
|
18
|
+
end
|
19
|
+
|
20
|
+
build_results
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def place
|
25
|
+
Place.new(place_name, organisation_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def method_missing(method_name, *args, &block)
|
29
|
+
if body.has_key?(method_name.to_s)
|
30
|
+
body[method_name.to_s]
|
31
|
+
else
|
32
|
+
super
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def call_api(options = {})
|
39
|
+
option_params = []
|
40
|
+
options.each_pair { |k, v| option_params << "#{ k }=#{ v }" }
|
41
|
+
|
42
|
+
self.data = self.class.get "#{ BASE_URL }/#{ organisation_name }/#{ place_name }/#{ name }" + '?' + option_params.join('&')
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_results
|
46
|
+
set_start = Time.parse(body['start_time'])
|
47
|
+
set_end = Time.parse(body['end_time'])
|
48
|
+
set_ratio = (set_end - set_start) / body['points'].to_i
|
49
|
+
body['results'].each do |result|
|
50
|
+
self.results << Result.new(set_start, set_start + set_ratio, result.first)
|
51
|
+
set_start = set_start + set_ratio
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Carbonculture
|
2
|
+
class Organisation
|
3
|
+
include HTTParty
|
4
|
+
attr_accessor :name, :data, :body
|
5
|
+
|
6
|
+
def initialize(name)
|
7
|
+
self.name = name
|
8
|
+
self.data = self.class.get "#{ BASE_URL }/#{ name }"
|
9
|
+
|
10
|
+
raise ArgumentError if data.response.code == '404'
|
11
|
+
self.body = JSON.parse(self.data.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def places
|
15
|
+
body['places'].map { |p| Place.new(p, name) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def method_missing(method_name, *args, &block)
|
19
|
+
if body.has_key?(method_name.to_s)
|
20
|
+
body[method_name.to_s]
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Carbonculture
|
2
|
+
class Place
|
3
|
+
include HTTParty
|
4
|
+
attr_accessor :name, :organisation_name, :data, :body
|
5
|
+
|
6
|
+
def initialize(name, org_name)
|
7
|
+
self.name = name
|
8
|
+
self.organisation_name = org_name
|
9
|
+
self.data = self.class.get "#{ BASE_URL }/#{ org_name }/#{ name }"
|
10
|
+
|
11
|
+
self.body = JSON.parse(self.data.body)
|
12
|
+
raise ArgumentError if status == 'fail'
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def organisation
|
17
|
+
Organisation.new(organisation_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def channels(options = {})
|
21
|
+
body['channels'].map { |c| Channel.new(c, name, organisation_name, options) }
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(method_name, *args, &block)
|
25
|
+
if body.has_key?(method_name.to_s)
|
26
|
+
body[method_name.to_s]
|
27
|
+
else
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,313 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://data.carbonculture.net/number10/10-downing-street/elec
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx/1.2.7
|
17
|
+
Date:
|
18
|
+
- Thu, 27 Jun 2013 10:19:20 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
- Authorization, Host
|
28
|
+
Access-Control-Allow-Headers:
|
29
|
+
- X-Requested-With
|
30
|
+
Access-Control-Allow-Credentials:
|
31
|
+
- 'false'
|
32
|
+
Api-Version:
|
33
|
+
- v1
|
34
|
+
Access-Control-Allow-Origin:
|
35
|
+
- ! '*'
|
36
|
+
Access-Control-Allow-Methods:
|
37
|
+
- POST,GET,OPTIONS
|
38
|
+
body:
|
39
|
+
encoding: US-ASCII
|
40
|
+
string: ! "{\n \"status\": \"ok\", \n \"fields\": [\n \"number10.10-downing-street.elec\"\n
|
41
|
+
\ ], \n \"start_time\": \"2013-06-26T10:00:00\", \n \"results\": [\n
|
42
|
+
\ [\n \"88.12\"\n ], \n [\n \"92.82\"\n
|
43
|
+
\ ], \n [\n \"92.34\"\n ], \n [\n \"87.49\"\n
|
44
|
+
\ ], \n [\n \"83.78\"\n ], \n [\n \"84.66\"\n
|
45
|
+
\ ], \n [\n \"88.29\"\n ], \n [\n \"86.98\"\n
|
46
|
+
\ ], \n [\n \"91.87\"\n ], \n [\n \"93.15\"\n
|
47
|
+
\ ], \n [\n \"87.61\"\n ], \n [\n \"90.94\"\n
|
48
|
+
\ ], \n [\n \"86.61\"\n ], \n [\n \"83.11\"\n
|
49
|
+
\ ], \n [\n \"82.54\"\n ], \n [\n \"76.97\"\n
|
50
|
+
\ ], \n [\n \"80.58\"\n ], \n [\n \"78.64\"\n
|
51
|
+
\ ], \n [\n \"75.54\"\n ], \n [\n \"72.24\"\n
|
52
|
+
\ ], \n [\n \"68.61\"\n ], \n [\n \"63.10\"\n
|
53
|
+
\ ], \n [\n \"60.13\"\n ], \n [\n \"59.83\"\n
|
54
|
+
\ ], \n [\n \"58.22\"\n ], \n [\n \"60.40\"\n
|
55
|
+
\ ], \n [\n \"58.20\"\n ], \n [\n \"56.65\"\n
|
56
|
+
\ ], \n [\n \"55.67\"\n ], \n [\n \"53.92\"\n
|
57
|
+
\ ], \n [\n \"52.61\"\n ], \n [\n \"52.55\"\n
|
58
|
+
\ ], \n [\n \"52.83\"\n ], \n [\n \"54.33\"\n
|
59
|
+
\ ], \n [\n \"55.32\"\n ], \n [\n \"55.77\"\n
|
60
|
+
\ ], \n [\n \"56.88\"\n ], \n [\n \"57.34\"\n
|
61
|
+
\ ], \n [\n \"60.89\"\n ], \n [\n \"79.19\"\n
|
62
|
+
\ ], \n [\n \"86.37\"\n ], \n [\n \"86.93\"\n
|
63
|
+
\ ], \n [\n \"88.98\"\n ], \n [\n \"88.08\"\n
|
64
|
+
\ ], \n [\n \"88.81\"\n ], \n [\n \"93.87\"\n
|
65
|
+
\ ], \n [\n \"89.94\"\n ], \n [\n \"84.21\"\n
|
66
|
+
\ ]\n ], \n \"points\": 48, \n \"end_time\": \"2013-06-27T10:00:00\"\n}"
|
67
|
+
http_version:
|
68
|
+
recorded_at: Thu, 27 Jun 2013 10:19:18 GMT
|
69
|
+
- request:
|
70
|
+
method: get
|
71
|
+
uri: http://data.carbonculture.net/number10/10-downing-street/fake
|
72
|
+
body:
|
73
|
+
encoding: US-ASCII
|
74
|
+
string: ''
|
75
|
+
headers: {}
|
76
|
+
response:
|
77
|
+
status:
|
78
|
+
code: 404
|
79
|
+
message: NOT FOUND
|
80
|
+
headers:
|
81
|
+
Server:
|
82
|
+
- nginx/1.2.7
|
83
|
+
Date:
|
84
|
+
- Thu, 27 Jun 2013 10:19:20 GMT
|
85
|
+
Content-Type:
|
86
|
+
- text/plain
|
87
|
+
Transfer-Encoding:
|
88
|
+
- chunked
|
89
|
+
Connection:
|
90
|
+
- keep-alive
|
91
|
+
Vary:
|
92
|
+
- Accept-Encoding
|
93
|
+
- Authorization, Host
|
94
|
+
Access-Control-Allow-Headers:
|
95
|
+
- X-Requested-With
|
96
|
+
Access-Control-Allow-Credentials:
|
97
|
+
- 'false'
|
98
|
+
Api-Version:
|
99
|
+
- v1
|
100
|
+
Access-Control-Allow-Origin:
|
101
|
+
- ! '*'
|
102
|
+
Access-Control-Allow-Methods:
|
103
|
+
- POST,GET,OPTIONS
|
104
|
+
body:
|
105
|
+
encoding: US-ASCII
|
106
|
+
string: ! 'Not Found: Unknown channels: number10.10-downing-street.fake'
|
107
|
+
http_version:
|
108
|
+
recorded_at: Thu, 27 Jun 2013 10:19:19 GMT
|
109
|
+
- request:
|
110
|
+
method: get
|
111
|
+
uri: http://data.carbonculture.net/number10/10-downing-street
|
112
|
+
body:
|
113
|
+
encoding: US-ASCII
|
114
|
+
string: ''
|
115
|
+
headers: {}
|
116
|
+
response:
|
117
|
+
status:
|
118
|
+
code: 200
|
119
|
+
message: OK
|
120
|
+
headers:
|
121
|
+
Server:
|
122
|
+
- nginx/1.2.7
|
123
|
+
Date:
|
124
|
+
- Thu, 27 Jun 2013 10:39:37 GMT
|
125
|
+
Content-Type:
|
126
|
+
- application/json; charset=utf-8
|
127
|
+
Transfer-Encoding:
|
128
|
+
- chunked
|
129
|
+
Connection:
|
130
|
+
- keep-alive
|
131
|
+
Vary:
|
132
|
+
- Accept-Encoding
|
133
|
+
- Authorization, Host
|
134
|
+
Access-Control-Allow-Headers:
|
135
|
+
- X-Requested-With
|
136
|
+
Access-Control-Allow-Credentials:
|
137
|
+
- 'false'
|
138
|
+
Api-Version:
|
139
|
+
- v1
|
140
|
+
Access-Control-Allow-Origin:
|
141
|
+
- ! '*'
|
142
|
+
Access-Control-Allow-Methods:
|
143
|
+
- POST,GET,OPTIONS
|
144
|
+
body:
|
145
|
+
encoding: US-ASCII
|
146
|
+
string: ! "{\n \"status\": \"ok\", \n \"operational_rating\": [\n {\n
|
147
|
+
\ \"end_date\": \"2011-06-27\", \n \"start_date\": \"2010-06-28\",
|
148
|
+
\n \"value\": 87\n }, \n {\n \"end_date\":
|
149
|
+
\"2012-06-27\", \n \"start_date\": \"2011-06-28\", \n \"value\":
|
150
|
+
83\n }, \n {\n \"end_date\": \"2013-06-27\", \n \"start_date\":
|
151
|
+
\"2012-06-28\", \n \"value\": 82\n }\n ], \n \"title\":
|
152
|
+
\"10 Downing Street\", \n \"link_url\": \"http://www.carbonculture.net/orgs/number10/10-downing-street/\",
|
153
|
+
\n \"namespace\": \"number10.10-downing-street\", \n \"channels\": [\n
|
154
|
+
\ \"heat\", \n \"elec\", \n \"gas\"\n ], \n \"place\":
|
155
|
+
\"10-downing-street\", \n \"image_url\": \"http://www.carbonculture.net/uploads/places/images/no10external_carbonculture_260.png\",
|
156
|
+
\n \"building_stats\": {}\n}"
|
157
|
+
http_version:
|
158
|
+
recorded_at: Thu, 27 Jun 2013 10:39:36 GMT
|
159
|
+
- request:
|
160
|
+
method: get
|
161
|
+
uri: http://data.carbonculture.net/number10/10-downing-street/elec?
|
162
|
+
body:
|
163
|
+
encoding: US-ASCII
|
164
|
+
string: ''
|
165
|
+
headers: {}
|
166
|
+
response:
|
167
|
+
status:
|
168
|
+
code: 200
|
169
|
+
message: OK
|
170
|
+
headers:
|
171
|
+
Server:
|
172
|
+
- nginx/1.2.7
|
173
|
+
Date:
|
174
|
+
- Tue, 02 Jul 2013 16:56:12 GMT
|
175
|
+
Content-Type:
|
176
|
+
- application/json; charset=utf-8
|
177
|
+
Transfer-Encoding:
|
178
|
+
- chunked
|
179
|
+
Connection:
|
180
|
+
- keep-alive
|
181
|
+
Vary:
|
182
|
+
- Accept-Encoding
|
183
|
+
- Authorization, Host
|
184
|
+
Access-Control-Allow-Headers:
|
185
|
+
- X-Requested-With
|
186
|
+
Access-Control-Allow-Credentials:
|
187
|
+
- 'false'
|
188
|
+
Api-Version:
|
189
|
+
- v1
|
190
|
+
Access-Control-Allow-Origin:
|
191
|
+
- ! '*'
|
192
|
+
Access-Control-Allow-Methods:
|
193
|
+
- POST,GET,OPTIONS
|
194
|
+
body:
|
195
|
+
encoding: US-ASCII
|
196
|
+
string: ! "{\n \"status\": \"ok\", \n \"fields\": [\n \"number10.10-downing-street.elec\"\n
|
197
|
+
\ ], \n \"start_time\": \"2013-07-01T16:30:00\", \n \"results\": [\n
|
198
|
+
\ [\n \"75.50\"\n ], \n [\n \"72.89\"\n
|
199
|
+
\ ], \n [\n \"71.99\"\n ], \n [\n \"72.37\"\n
|
200
|
+
\ ], \n [\n \"70.30\"\n ], \n [\n \"66.59\"\n
|
201
|
+
\ ], \n [\n \"63.28\"\n ], \n [\n \"62.36\"\n
|
202
|
+
\ ], \n [\n \"60.68\"\n ], \n [\n \"59.41\"\n
|
203
|
+
\ ], \n [\n \"65.21\"\n ], \n [\n \"60.99\"\n
|
204
|
+
\ ], \n [\n \"56.84\"\n ], \n [\n \"56.25\"\n
|
205
|
+
\ ], \n [\n \"55.78\"\n ], \n [\n \"55.73\"\n
|
206
|
+
\ ], \n [\n \"55.77\"\n ], \n [\n \"54.35\"\n
|
207
|
+
\ ], \n [\n \"56.25\"\n ], \n [\n \"54.22\"\n
|
208
|
+
\ ], \n [\n \"53.64\"\n ], \n [\n \"54.98\"\n
|
209
|
+
\ ], \n [\n \"54.55\"\n ], \n [\n \"53.62\"\n
|
210
|
+
\ ], \n [\n \"55.58\"\n ], \n [\n \"60.07\"\n
|
211
|
+
\ ], \n [\n \"75.33\"\n ], \n [\n \"79.11\"\n
|
212
|
+
\ ], \n [\n \"85.69\"\n ], \n [\n \"91.82\"\n
|
213
|
+
\ ], \n [\n \"90.93\"\n ], \n [\n \"91.63\"\n
|
214
|
+
\ ], \n [\n \"91.10\"\n ], \n [\n \"91.66\"\n
|
215
|
+
\ ], \n [\n \"95.61\"\n ], \n [\n \"91.94\"\n
|
216
|
+
\ ], \n [\n \"92.37\"\n ], \n [\n \"89.87\"\n
|
217
|
+
\ ], \n [\n \"91.47\"\n ], \n [\n \"89.40\"\n
|
218
|
+
\ ], \n [\n \"89.98\"\n ], \n [\n \"88.74\"\n
|
219
|
+
\ ], \n [\n \"90.59\"\n ], \n [\n \"95.25\"\n
|
220
|
+
\ ], \n [\n \"96.95\"\n ], \n [\n \"93.33\"\n
|
221
|
+
\ ], \n [\n \"93.41\"\n ], \n [\n \"89.97\"\n
|
222
|
+
\ ]\n ], \n \"points\": 48, \n \"end_time\": \"2013-07-02T16:30:00\"\n}"
|
223
|
+
http_version:
|
224
|
+
recorded_at: Tue, 02 Jul 2013 16:56:11 GMT
|
225
|
+
- request:
|
226
|
+
method: get
|
227
|
+
uri: http://data.carbonculture.net/number10/10-downing-street/elec?points=12
|
228
|
+
body:
|
229
|
+
encoding: US-ASCII
|
230
|
+
string: ''
|
231
|
+
headers: {}
|
232
|
+
response:
|
233
|
+
status:
|
234
|
+
code: 200
|
235
|
+
message: OK
|
236
|
+
headers:
|
237
|
+
Server:
|
238
|
+
- nginx/1.2.7
|
239
|
+
Date:
|
240
|
+
- Tue, 02 Jul 2013 16:56:13 GMT
|
241
|
+
Content-Type:
|
242
|
+
- application/json; charset=utf-8
|
243
|
+
Transfer-Encoding:
|
244
|
+
- chunked
|
245
|
+
Connection:
|
246
|
+
- keep-alive
|
247
|
+
Vary:
|
248
|
+
- Accept-Encoding
|
249
|
+
- Authorization, Host
|
250
|
+
Access-Control-Allow-Headers:
|
251
|
+
- X-Requested-With
|
252
|
+
Access-Control-Allow-Credentials:
|
253
|
+
- 'false'
|
254
|
+
Api-Version:
|
255
|
+
- v1
|
256
|
+
Access-Control-Allow-Origin:
|
257
|
+
- ! '*'
|
258
|
+
Access-Control-Allow-Methods:
|
259
|
+
- POST,GET,OPTIONS
|
260
|
+
body:
|
261
|
+
encoding: US-ASCII
|
262
|
+
string: ! "{\n \"status\": \"ok\", \n \"fields\": [\n \"number10.10-downing-street.elec\"\n
|
263
|
+
\ ], \n \"start_time\": \"2013-07-01T16:30:00\", \n \"results\": [\n
|
264
|
+
\ [\n \"292.71\"\n ], \n [\n \"262.53\"\n
|
265
|
+
\ ], \n [\n \"246.31\"\n ], \n [\n \"224.61\"\n
|
266
|
+
\ ], \n [\n \"220.64\"\n ], \n [\n \"216.71\"\n
|
267
|
+
\ ], \n [\n \"270.12\"\n ], \n [\n \"360.08\"\n
|
268
|
+
\ ], \n [\n \"370.28\"\n ], \n [\n \"363.11\"\n
|
269
|
+
\ ], \n [\n \"364.57\"\n ], \n [\n \"373.66\"\n
|
270
|
+
\ ]\n ], \n \"points\": 12, \n \"end_time\": \"2013-07-02T16:30:00\"\n}"
|
271
|
+
http_version:
|
272
|
+
recorded_at: Tue, 02 Jul 2013 16:56:11 GMT
|
273
|
+
- request:
|
274
|
+
method: get
|
275
|
+
uri: http://data.carbonculture.net/number10/10-downing-street/fake?
|
276
|
+
body:
|
277
|
+
encoding: US-ASCII
|
278
|
+
string: ''
|
279
|
+
headers: {}
|
280
|
+
response:
|
281
|
+
status:
|
282
|
+
code: 404
|
283
|
+
message: NOT FOUND
|
284
|
+
headers:
|
285
|
+
Server:
|
286
|
+
- nginx/1.2.7
|
287
|
+
Date:
|
288
|
+
- Tue, 02 Jul 2013 16:56:13 GMT
|
289
|
+
Content-Type:
|
290
|
+
- text/plain
|
291
|
+
Transfer-Encoding:
|
292
|
+
- chunked
|
293
|
+
Connection:
|
294
|
+
- keep-alive
|
295
|
+
Vary:
|
296
|
+
- Accept-Encoding
|
297
|
+
- Authorization, Host
|
298
|
+
Access-Control-Allow-Headers:
|
299
|
+
- X-Requested-With
|
300
|
+
Access-Control-Allow-Credentials:
|
301
|
+
- 'false'
|
302
|
+
Api-Version:
|
303
|
+
- v1
|
304
|
+
Access-Control-Allow-Origin:
|
305
|
+
- ! '*'
|
306
|
+
Access-Control-Allow-Methods:
|
307
|
+
- POST,GET,OPTIONS
|
308
|
+
body:
|
309
|
+
encoding: US-ASCII
|
310
|
+
string: ! 'Not Found: Unknown channels: number10.10-downing-street.fake'
|
311
|
+
http_version:
|
312
|
+
recorded_at: Tue, 02 Jul 2013 16:56:11 GMT
|
313
|
+
recorded_with: VCR 2.5.0
|