textract 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1329ef4f0beb75631d3a34160d9e5e525efa6792
4
- data.tar.gz: 633208f798be1ed7dc2a3898ecfca96ae32c69db
3
+ metadata.gz: 7dfaec842302697fff5fb526bc358045d63aeabb
4
+ data.tar.gz: 6bfa752901cf6bf183ea50370100701224a49ba8
5
5
  SHA512:
6
- metadata.gz: b34cb339fb187ce2247ec8f46a498d368f92b755f830730f645d5a29e77cfdf2901b6b94daeca3185390e35e55d418ae3a2f5d5092c46064d965d7c00fb0ce30
7
- data.tar.gz: be8ab847fcdddd3fcb176113579395f922b07fd20ff4ed41fbd3dab655e6500caf7268c28d94479e13bc9edd67d25ee24541f309075fe015d20add28712a51cd
6
+ metadata.gz: f667c4d08fbc1658d1ac98ccd5e79eae4871a51e18e425717573903d2c14f3fceb4f9d37068a410dc01c88e58cf4b6264f26ead1708d8ca867bf430daf439a5d
7
+ data.tar.gz: cfef813ebb6fb91e37a71c952e06a56cee13520497a198f480d7f090eebc1b598f9f6dbf67bce8de1f0fa9fbee2d7595e8e5842077d14e6b06dca34b84e0c64d
@@ -1,3 +1,3 @@
1
1
  module Textract
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/textract.rb CHANGED
@@ -85,5 +85,19 @@ module Textract
85
85
  @author = @article.author || Textract.get_author(@html)
86
86
  @title = @tags.title || Textract.get_page_title(@html)
87
87
  end
88
+
89
+ def to_json
90
+ to_h.to_json
91
+ end
92
+
93
+ def to_h
94
+ {
95
+ url: @url,
96
+ text: @text,
97
+ md5: @md5,
98
+ author: @author,
99
+ title: @title,
100
+ }
101
+ end
88
102
  end
89
103
  end
@@ -37,4 +37,10 @@ describe Textract do
37
37
  expect(Textract.get_author(html)).to eq "Adam Pash"
38
38
  end
39
39
 
40
+ it "converts itself to json" do
41
+ url = "http://gawker.com/1694508525"
42
+ article = Textract.get_text(url)
43
+ expect(article.to_json).to be_a_kind_of String
44
+ end
45
+
40
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textract
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Pash