everlog 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/everlog/dom/entity/aggregate/dailyReport.rb +4 -9
- data/lib/everlog/dom/entity/config.rb +1 -1
- data/lib/everlog/dom/entity/content.erb +1 -1
- data/lib/everlog/dom/module/weather.rb +1 -1
- data/lib/everlog/inf/api/wunderground.rb +5 -3
- data/lib/everlog/version.rb +1 -1
- data/spec/lifelog/dom/module/weather_spec.rb +5 -0
- data/spec/lifelog/inf/api/wunderground_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 593aadef0699ed990c3a8169046423de22afe5d7
|
4
|
+
data.tar.gz: 4408157735df19b6e45ebe685e978abe84eb1533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc7ad61e373a7d3c6a59e20b3d4027dadc381f0c81ab675af5f5c4a7f11edf8d9b702036eec534495fa73fefc3ecb4c5fb34ff49d260b42256cd73429bffd269
|
7
|
+
data.tar.gz: d40da3484d3cd79be9056414fe72e6081ac483abca5876d15caf8a04b4353a56473785e774b3d560b63e72da3f532a32c152a6f3710e384b922cac732241a0e3
|
@@ -29,15 +29,10 @@ class Everlog
|
|
29
29
|
|
30
30
|
private
|
31
31
|
def setup_config(service, option)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
Config.send(service).consumer_key = option[:consumer_key]
|
37
|
-
Config.send(service).consumer_secret = option[:consumer_secret]
|
38
|
-
Config.send(service).access_token = option[:access_token]
|
39
|
-
Config.send(service).access_secret = option[:access_secret]
|
40
|
-
end
|
32
|
+
Config.send(service).consumer_key = option[:consumer_key]
|
33
|
+
Config.send(service).consumer_secret = option[:consumer_secret]
|
34
|
+
Config.send(service).access_token = option[:access_token]
|
35
|
+
Config.send(service).access_secret = option[:access_secret]
|
41
36
|
end
|
42
37
|
end
|
43
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Entity::Config < Dom::Entity
|
3
|
-
THIRD_PARTY = %w(evernote twitter hatena github moves animetick
|
3
|
+
THIRD_PARTY = %w(evernote twitter hatena github moves animetick weather googlemap).freeze
|
4
4
|
|
5
5
|
THIRD_PARTY.each do |service|
|
6
6
|
const_set service.capitalize, Class.new {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Weather < Dom::Module
|
3
3
|
def self.fetch_since(date)
|
4
|
-
config = Dom::Entity::Config.
|
4
|
+
config = Dom::Entity::Config.weather
|
5
5
|
api_response = Inf::Api::Wunderground.new(config).yesterday('Tokyo')
|
6
6
|
Dom::Value::Weather.new(api_response)
|
7
7
|
end
|
@@ -3,13 +3,15 @@ class Everlog
|
|
3
3
|
require 'wunderground'
|
4
4
|
|
5
5
|
def client
|
6
|
-
@client ||= Wunderground.new(@config.
|
6
|
+
@client ||= ::Wunderground.new(@config.access_token, throws_exceptions: true)
|
7
7
|
end
|
8
8
|
|
9
9
|
def yesterday place
|
10
10
|
client.yesterday_for(place)['history']
|
11
|
-
rescue
|
12
|
-
|
11
|
+
rescue => e
|
12
|
+
raise InfrastructureWeatherError, "yesterday error / #{e.message}"
|
13
13
|
end
|
14
|
+
|
15
|
+
class InfrastructureWeatherError < StandardError; end
|
14
16
|
end
|
15
17
|
end
|
data/lib/everlog/version.rb
CHANGED
@@ -3,6 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe Everlog::Dom::Module::Weather do
|
4
4
|
|
5
5
|
describe '.fetch_since' do
|
6
|
+
before do
|
7
|
+
response = load_fixture('wunderground/yesterday_response.json')['response']
|
8
|
+
Everlog::Inf::Api::Wunderground.any_instance.should_receive(:yesterday).and_return(response)
|
9
|
+
end
|
10
|
+
|
6
11
|
subject { described_class.fetch_since('dummy') }
|
7
12
|
it { expect(subject.max_temp).to be_instance_of Fixnum }
|
8
13
|
it { expect(subject.min_temp).to be_instance_of Fixnum }
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Everlog::Inf::Api::Wunderground do
|
4
4
|
let(:instance) do
|
5
|
-
described_class.new(double('config',
|
5
|
+
described_class.new(double('config', access_token: ENV['wunderground_token']))
|
6
6
|
end
|
7
7
|
|
8
8
|
describe '#yesterday' do
|