tepco_usage_api 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,20 @@
1
+ = About This Gem
2
+
3
+ This gem provides tepco-usage-api wrapper class.
4
+ The wrapper class allows us to easily get the power usage information provided by TEPCO.
5
+
6
+ - http://tepco-usage-api.appspot.com
7
+ - http://www.tepco.co.jp/
8
+
9
+ = Installation
10
+
11
+ gem install tepco_usage_api
12
+
13
+ = Usage
14
+
15
+ require 'tepco_usage_api'
16
+
17
+ puts TepcoUsage.latest
18
+
19
+ Autho:: Tatsuya Sato
20
+ E-mail:: satoryu.1981@gmail.com
@@ -19,6 +19,12 @@ class TepcoUsage
19
19
  JSON.parse(response.body)
20
20
  end
21
21
 
22
+ def in(arg)
23
+ path = "/#{arg.year}/#{arg.month}.json"
24
+ response = request(path)
25
+ JSON.parse(response.body)
26
+ end
27
+
22
28
  private
23
29
  def request(path)
24
30
  http.request_get(path)
@@ -113,4 +113,16 @@ describe TepcoUsage do
113
113
  it { should_not be_nil }
114
114
  end
115
115
  end
116
+ describe "#in" do
117
+ before do
118
+ @now = Time.now
119
+ path = "/#{@now.year}/#{@now.month}.json"
120
+ TepcoUsage.stub!(:request).with(path).and_return do
121
+ mock(Object.new, :body => '{"body": "dummy"}')
122
+ end
123
+ end
124
+
125
+ subject{TepcoUsage.in @now}
126
+ it { should_not be_nil }
127
+ end
116
128
  end
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tepco_usage_api
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
6
10
  platform: ruby
7
11
  authors:
8
12
  - Tatsuya Sato
@@ -10,11 +14,14 @@ autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2011-03-27 00:00:00 +09:00
17
+ date: 2011-06-01 00:00:00 +09:00
14
18
  default_executable:
15
19
  dependencies: []
16
20
 
17
- description:
21
+ description: |
22
+ This gem provides tepco-usage-api wrapper class.
23
+ The wrapper class allows us to easily get the power usage information provided by TEPCO.
24
+
18
25
  email: satoryu.1981@gmail.com
19
26
  executables: []
20
27
 
@@ -23,14 +30,15 @@ extensions: []
23
30
  extra_rdoc_files: []
24
31
 
25
32
  files:
33
+ - README.rdoc
26
34
  - LICENCE.txt
27
35
  - lib/tepco_usage_api.rb
28
36
  - spec/tepco_usage_api_spec.rb
29
37
  - spec/spec_helper.rb
30
38
  has_rdoc: true
31
39
  homepage: http://github.com/satoryu/tepco_usage_api/
32
- licenses: []
33
-
40
+ licenses:
41
+ - MIT
34
42
  post_install_message:
35
43
  rdoc_options: []
36
44
 
@@ -41,17 +49,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
41
49
  requirements:
42
50
  - - ">="
43
51
  - !ruby/object:Gem::Version
52
+ segments:
53
+ - 1
54
+ - 8
55
+ - 7
44
56
  version: 1.8.7
45
57
  required_rubygems_version: !ruby/object:Gem::Requirement
46
58
  none: false
47
59
  requirements:
48
60
  - - ">="
49
61
  - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
50
64
  version: "0"
51
65
  requirements: []
52
66
 
53
67
  rubyforge_project:
54
- rubygems_version: 1.5.2
68
+ rubygems_version: 1.3.7
55
69
  signing_key:
56
70
  specification_version: 3
57
71
  summary: The gem to talk with Tepco Usage API.