apple-news 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apple-news.rb +1 -0
- data/lib/apple-news/article.rb +6 -1
- data/lib/apple-news/article/persistence.rb +14 -0
- data/lib/apple-news/version.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: d9d7cd19f246e56cf2f9f34e75a9f13e4b04af03
|
4
|
+
data.tar.gz: 035e174af117ae59fb88c0cb7ad7853a46c992e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0246860bc592b2c3998f271af6c408ddce0700f0f249a968867764306596530661248ffd2788271accc3e445e415ec525d5b5342107c818fcd5b37dca1cb9b
|
7
|
+
data.tar.gz: 34243c49afbcbeac6263777b5dfeb5ae021c7427f53c5fcc2a1a3d1f15ae5ea1d4dd0516114ec9f0691217cdacefb117fc60f0298d9087583056bab4dcfeb40f
|
data/lib/apple-news.rb
CHANGED
data/lib/apple-news/article.rb
CHANGED
@@ -34,6 +34,11 @@ module AppleNews
|
|
34
34
|
hydrate! if !id.nil? && data.keys.size == 0
|
35
35
|
end
|
36
36
|
|
37
|
+
def reload
|
38
|
+
return false if id.nil?
|
39
|
+
hydrate!
|
40
|
+
end
|
41
|
+
|
37
42
|
private
|
38
43
|
|
39
44
|
def hydrate!
|
@@ -41,7 +46,7 @@ module AppleNews
|
|
41
46
|
|
42
47
|
# Some special properties that need to be manually set.
|
43
48
|
@document = Document.new(data.delete('document'))
|
44
|
-
@share_url = data.delete('
|
49
|
+
@share_url = data.delete('shareUrl')
|
45
50
|
@state = data.delete('state')
|
46
51
|
|
47
52
|
load_properties(data)
|
@@ -36,6 +36,20 @@ module AppleNews
|
|
36
36
|
true
|
37
37
|
end
|
38
38
|
|
39
|
+
def save_to_disk!(path)
|
40
|
+
FileUtils.mkdir_p(path)
|
41
|
+
|
42
|
+
# Write the article.json
|
43
|
+
File.write(File.join(path, "article.json"), JSON.dump(document.as_json))
|
44
|
+
|
45
|
+
# Write all of the bundled files
|
46
|
+
@files.each do |name, file|
|
47
|
+
File.write(File.join(path, name), file.read)
|
48
|
+
end
|
49
|
+
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
39
53
|
private
|
40
54
|
|
41
55
|
def endpoint_url
|
data/lib/apple-news/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple-news
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|