everlog 0.0.3 → 0.0.4
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 +0 -4
- data/lib/everlog/dom/entity/config.rb +28 -4
- data/lib/everlog/dom/module/animetick.rb +9 -7
- data/lib/everlog/dom/module/evernote.rb +14 -4
- data/lib/everlog/dom/module/hatena.rb +10 -7
- data/lib/everlog/dom/module/moves.rb +1 -5
- data/lib/everlog/dom/module/twitter.rb +9 -5
- data/lib/everlog/dom/module/weather.rb +9 -4
- data/lib/everlog/dom/module.rb +5 -0
- data/lib/everlog/version.rb +1 -1
- data/spec/lifelog/dom/entity/config_spec.rb +5 -3
- data/spec/lifelog/dom/module/moves_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d79084fcdd5b08672341998b58a2995c17f7baff
|
4
|
+
data.tar.gz: 7a728cb089abda88a9067de09d8fa810301215ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77135165dd82d6166843e0f734cee8856cbb5ed82f048f832b7bda36bbeb87abcadd534fd75852093b65b4f70abfd786bf6522dad95cb259e75989ca417a631f
|
7
|
+
data.tar.gz: db68b5979b7dc0b2ae0e410e287893a69da40071d5a05cfb46c703841b5b7da9bb1f8ff5a7620e7931f50d92b7e20024738ac82d2bcaec66a995b910d1dd3cea
|
@@ -19,8 +19,6 @@ class Everlog
|
|
19
19
|
|
20
20
|
def publish(title, access_token, output)
|
21
21
|
return @content.render if output == 'local'
|
22
|
-
raise EverlogConfigError, 'evernote access_token not given' if access_token.nil?
|
23
|
-
|
24
22
|
Config.evernote.access_secret = access_token
|
25
23
|
Dom::Module::Evernote.publish(title, @content.render, output)
|
26
24
|
ensure
|
@@ -36,6 +34,4 @@ class Everlog
|
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
39
|
-
|
40
|
-
class EverlogConfigError < StandardError; end
|
41
37
|
end
|
@@ -5,10 +5,32 @@ class Everlog
|
|
5
5
|
THIRD_PARTY.each do |service|
|
6
6
|
const_set service.capitalize, Class.new {
|
7
7
|
class << self
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
attr_writer :consumer_key
|
9
|
+
attr_writer :consumer_secret
|
10
|
+
attr_writer :access_token
|
11
|
+
attr_writer :access_secret
|
12
|
+
|
13
|
+
def message
|
14
|
+
service_name = self.name.split('::').last.downcase
|
15
|
+
required_param = caller()[0].match(/`.*'?/).to_s.delete('`\'')
|
16
|
+
"#{service_name} #{required_param} is requried."
|
17
|
+
end
|
18
|
+
|
19
|
+
def consumer_key
|
20
|
+
@consumer_key.nil? ? raise(Everlog::DomainConfigError, message) : @consumer_key
|
21
|
+
end
|
22
|
+
|
23
|
+
def consumer_secret
|
24
|
+
@consumer_secret.nil? ? raise(Everlog::DomainConfigError, message) : @consumer_secret
|
25
|
+
end
|
26
|
+
|
27
|
+
def access_token
|
28
|
+
@access_token.nil? ? raise(Everlog::DomainConfigError, message) : @access_token
|
29
|
+
end
|
30
|
+
|
31
|
+
def access_secret
|
32
|
+
@access_secret.nil? ? raise(Everlog::DomainConfigError, message) : @access_secret
|
33
|
+
end
|
12
34
|
end
|
13
35
|
}
|
14
36
|
end
|
@@ -27,4 +49,6 @@ class Everlog
|
|
27
49
|
end
|
28
50
|
end
|
29
51
|
end
|
52
|
+
|
53
|
+
class DomainConfigError < StandardError; end
|
30
54
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Animetick < Dom::Module
|
3
|
-
def
|
4
|
-
|
5
|
-
|
3
|
+
def ticket_list
|
4
|
+
Inf::Api::Animetick.new(@config).ticket_list
|
5
|
+
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
class << self
|
8
|
+
def fetch_since date
|
9
|
+
self.new.ticket_list.map do |r|
|
10
|
+
ticket = Dom::Value::Animetick.new(r)
|
11
|
+
ticket.updated_at > date ? ticket : nil
|
12
|
+
end.compact
|
10
13
|
end
|
11
|
-
tickets.compact
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,9 +1,19 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Evernote < Dom::Module
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
def initialize is_sandbox
|
4
|
+
@is_sandbox = is_sandbox
|
5
|
+
super()
|
6
|
+
end
|
7
|
+
|
8
|
+
def save(title, content)
|
9
|
+
Dom::Repository::Evernote.new(@is_sandbox, @config).save(title, content)
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def publish(title, content, output)
|
14
|
+
is_sandbox = output != 'production'
|
15
|
+
self.new(is_sandbox).save(title, content)
|
16
|
+
end
|
7
17
|
end
|
8
18
|
end
|
9
19
|
end
|
@@ -1,13 +1,16 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Hatena < Dom::Module
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
def feed_entry
|
4
|
+
Inf::Api::Hatena.new(@config).feed_entry
|
5
|
+
end
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def fetch_since date
|
9
|
+
self.new.feed_entry.map do |r|
|
10
|
+
feed = Dom::Value::Hatena.new(r)
|
11
|
+
feed.issued > date ? feed : nil
|
12
|
+
end.compact
|
9
13
|
end
|
10
|
-
bookmarks.compact
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Moves < Dom::Module
|
3
|
-
def initialize config
|
4
|
-
@config = config
|
5
|
-
end
|
6
|
-
|
7
3
|
def api_client
|
8
4
|
@api_client ||= Inf::Api::Moves.new(@config)
|
9
5
|
end
|
@@ -26,7 +22,7 @@ class Everlog
|
|
26
22
|
class << self
|
27
23
|
# date対応してない
|
28
24
|
def fetch_since date
|
29
|
-
instance = self.new
|
25
|
+
instance = self.new
|
30
26
|
{ summary: instance.summary, storyline: instance.storyline }
|
31
27
|
end
|
32
28
|
end
|
@@ -1,10 +1,14 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Twitter < Dom::Module
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
def timeline
|
4
|
+
Inf::Api::Twitter.new(@config).timeline
|
5
|
+
end
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def fetch_since date
|
9
|
+
tweets = self.new.timeline.map { |r| Dom::Value::Twitter.new(r) if r.created_at > date }
|
10
|
+
tweets.compact.reverse
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
@@ -1,9 +1,14 @@
|
|
1
1
|
class Everlog
|
2
2
|
class Dom::Module::Weather < Dom::Module
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
def yesterday
|
4
|
+
Inf::Api::Wunderground.new(@config).yesterday('Tokyo')
|
5
|
+
end
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def fetch_since(date)
|
9
|
+
api_response = self.new.yesterday
|
10
|
+
Dom::Value::Weather.new(api_response)
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
9
14
|
end
|
data/lib/everlog/dom/module.rb
CHANGED
@@ -7,5 +7,10 @@ class Everlog
|
|
7
7
|
require 'everlog/dom/module/animetick'
|
8
8
|
require 'everlog/dom/module/weather'
|
9
9
|
require 'everlog/dom/module/evernote'
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
service = self.class.name.split('::').last.downcase
|
13
|
+
@config = Dom::Entity::Config.send(service)
|
14
|
+
end
|
10
15
|
end
|
11
16
|
end
|
data/lib/everlog/version.rb
CHANGED
@@ -5,18 +5,20 @@ describe Everlog::Dom::Entity::Config do
|
|
5
5
|
|
6
6
|
context 'normal' do
|
7
7
|
it do
|
8
|
-
expect(subject.twitter.access_token).to be_nil
|
9
8
|
expect { subject.twitter.access_token = 'hoge' }.not_to raise_error
|
10
9
|
expect(subject.twitter.access_token).to eq 'hoge'
|
11
10
|
subject.evernote.access_token = 'fuga'
|
12
11
|
subject.clear!
|
13
|
-
expect
|
14
|
-
expect
|
12
|
+
expect { subject.twitter.access_token }.to raise_error Everlog::DomainConfigError
|
13
|
+
expect { subject.evernote.access_token }.to raise_error Everlog::DomainConfigError
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
context 'abnormal' do
|
19
18
|
it { expect { subject.invalid_service.access_token }.to raise_error NoMethodError }
|
20
19
|
it { expect { subject.twitter.invalid_method }.to raise_error NoMethodError }
|
20
|
+
it 'raise configure error when value is nil' do
|
21
|
+
expect { subject.twitter.consumer_key }.to raise_error(Everlog::DomainConfigError, /twitter consumer_key/)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: everlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gong023
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evernote_oauth
|