diffbot 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.gitignore +1 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +24 -6
- data/README.md +7 -1
- data/diffbot.gemspec +4 -2
- data/lib/diffbot/article.rb +15 -8
- data/test/test_helper.rb +3 -0
- metadata +35 -21
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDNiODQ2NWVjN2QyMWZmZDAwNGUyN2I1ZGMxYzE0NjZjNTgxODM1OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzNhMzIyMDVhMzA4OWE1MmVmZjc5MTIzYTY1ZGU1NTY0MGNkYzE3Ng==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDkxYmE0Mjc2MThiMTU2NmQzNjYyZTI4ZmQzYzQ4NWZiN2JmNDQ4YTI0MTY1
|
10
|
+
YjEzZGYxZTVlYjY4ODljNzMwNDM4YmI1ZDQ5Y2UyOWI5NjQ2OThjNDNiMzY3
|
11
|
+
OWU3OTY3OTNmMGYwZTBjZjU2Nzc2ZmIzNjg4ZTkzOGJjMTQwODk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Y2U5NzUwOTg2ZmM2Mzk1NzhiODYxZDg3NGU3ZTUxMTIyMWFiZjhkZDRlZTFk
|
14
|
+
YjY4YjY0NzM5NTZhYWNkZTgzMmI1MzI1ODQwODk0ZTJjOTEwNjI4ZGE5YjVj
|
15
|
+
MmMyODE5Y2NjYmRkMDY4ZjVlNDY1YzY3OWQyMzkwODg3NTRhMDg=
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,27 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
diffbot (0.1.
|
4
|
+
diffbot (0.1.8)
|
5
5
|
excon
|
6
|
-
hashie
|
6
|
+
hashie (= 3.3.2)
|
7
7
|
nokogiri (~> 1.5.0)
|
8
8
|
yajl-ruby
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
|
14
|
-
|
13
|
+
codeclimate-test-reporter (0.4.1)
|
14
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
15
|
+
coderay (1.1.0)
|
16
|
+
docile (1.1.5)
|
17
|
+
excon (0.43.0)
|
18
|
+
hashie (3.3.2)
|
19
|
+
method_source (0.8.2)
|
15
20
|
minitest (4.7.0)
|
16
|
-
|
21
|
+
multi_json (1.10.1)
|
22
|
+
nokogiri (1.5.11)
|
23
|
+
pry (0.10.1)
|
24
|
+
coderay (~> 1.1.0)
|
25
|
+
method_source (~> 0.8.1)
|
26
|
+
slop (~> 3.4)
|
17
27
|
rake (10.0.4)
|
18
|
-
|
28
|
+
simplecov (0.9.1)
|
29
|
+
docile (~> 1.1.0)
|
30
|
+
multi_json (~> 1.0)
|
31
|
+
simplecov-html (~> 0.8.0)
|
32
|
+
simplecov-html (0.8.0)
|
33
|
+
slop (3.6.0)
|
34
|
+
yajl-ruby (1.2.1)
|
19
35
|
|
20
36
|
PLATFORMS
|
21
37
|
ruby
|
22
38
|
|
23
39
|
DEPENDENCIES
|
24
40
|
bundler (~> 1.3)
|
41
|
+
codeclimate-test-reporter
|
25
42
|
diffbot!
|
26
43
|
minitest
|
44
|
+
pry
|
27
45
|
rake
|
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Diffbot
|
2
2
|
|
3
|
-
This is a ruby client for the [Diffbot](http://diffbot.com) API.
|
3
|
+
This is a ruby client for the [Diffbot](http://diffbot.com) API.
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/diffbot.svg)](http://badge.fury.io/rb/diffbot)
|
6
|
+
[![Dependency Status](https://gemnasium.com/greshny/diffbot.svg)](https://gemnasium.com/greshny/diffbot)
|
7
|
+
[![Build Status](https://travis-ci.org/greshny/diffbot.png?branch=master)](https://travis-ci.org/greshny/diffbot)
|
8
|
+
[![Code Climate](https://codeclimate.com/github/greshny/diffbot/badges/gpa.svg)](https://codeclimate.com/github/greshny/diffbot)
|
9
|
+
[![Test Coverage](https://codeclimate.com/github/greshny/diffbot/badges/coverage.svg)](https://codeclimate.com/github/greshny/diffbot)
|
4
10
|
|
5
11
|
## Install
|
6
12
|
|
data/diffbot.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "diffbot"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.8"
|
4
4
|
s.description = "Diffbot provides a concise API for analyzing and extracting semantic information from web pages using Diffbot (http://www.diffbot.com)."
|
5
5
|
s.summary = "Ruby interface to the Diffbot API "
|
6
6
|
s.authors = ["Nicolas Sanguinetti", "Roman Greshny"]
|
@@ -13,7 +13,9 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.add_dependency("excon")
|
14
14
|
s.add_dependency("yajl-ruby")
|
15
15
|
s.add_dependency("nokogiri", "~> 1.5.0")
|
16
|
-
s.add_dependency("hashie")
|
16
|
+
s.add_dependency("hashie", "3.3.2")
|
17
|
+
|
17
18
|
s.add_development_dependency("bundler", "~> 1.3")
|
18
19
|
s.add_development_dependency("minitest")
|
20
|
+
s.add_development_dependency("pry")
|
19
21
|
end
|
data/lib/diffbot/article.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
require "yajl"
|
2
|
+
require 'hashie/extensions/dash/indifferent_access'
|
3
|
+
require 'hashie/extensions/indifferent_access'
|
4
|
+
require 'hashie/trash'
|
5
|
+
require 'hashie/extensions/coercion'
|
2
6
|
|
3
7
|
module Diffbot
|
4
8
|
# Representation of an article (ie a blog post or similar). This class offers
|
5
9
|
# a single entry point: the `.fetch` method, that, given a URL, will return
|
6
10
|
# the article as analyzed by Diffbot.
|
7
11
|
class Article < Hashie::Trash
|
8
|
-
|
12
|
+
include Hashie::Extensions::Coercion
|
13
|
+
include Hashie::Extensions::IndifferentAccess
|
9
14
|
|
10
15
|
# Public: Fetch an article from a URL.
|
11
16
|
#
|
@@ -68,6 +73,7 @@ module Diffbot
|
|
68
73
|
property :human_language, from: :humanLanguage
|
69
74
|
|
70
75
|
class MediaItem < Hashie::Trash
|
76
|
+
include Hashie::Extensions::IndifferentAccess
|
71
77
|
property :type
|
72
78
|
property :link
|
73
79
|
property :primary, default: false
|
@@ -82,9 +88,10 @@ module Diffbot
|
|
82
88
|
# primary - Only present in one of the items. This is assumed to be the most
|
83
89
|
# representative media for this article.
|
84
90
|
property :media
|
85
|
-
|
91
|
+
coerce_key :media, Array[MediaItem]
|
86
92
|
|
87
93
|
class ImageItem < Hashie::Trash
|
94
|
+
include Hashie::Extensions::IndifferentAccess
|
88
95
|
property :url
|
89
96
|
property :pixel_height, from: :pixelHeight
|
90
97
|
property :pixel_width, from: :pixelWidth
|
@@ -100,8 +107,7 @@ module Diffbot
|
|
100
107
|
# pixel_weight - Image width, in pixels.
|
101
108
|
# caption - Diffbot-determined best caption for the image, if detected.
|
102
109
|
# primary - Returns "true" if image is identified as primary.
|
103
|
-
|
104
|
-
coerce_property :images, collection: ImageItem
|
110
|
+
coerce_key :images, Array[ImageItem]
|
105
111
|
|
106
112
|
# Public: The raw text of the article, without formatting.
|
107
113
|
property :text
|
@@ -135,6 +141,7 @@ module Diffbot
|
|
135
141
|
property :supertags
|
136
142
|
|
137
143
|
class VideoItem < Hashie::Trash
|
144
|
+
include Hashie::Extensions::IndifferentAccess
|
138
145
|
property :url
|
139
146
|
property :pixel_height, from: :pixelHeight
|
140
147
|
property :pixel_width, from: :pixelWidth
|
@@ -147,10 +154,10 @@ module Diffbot
|
|
147
154
|
# pixel_height - Video height, in pixels, if accessible.
|
148
155
|
# pixel_width - Video width, in pixels, if accessible.
|
149
156
|
# primary - Returns "true" if the video is identified as primary.
|
150
|
-
|
151
|
-
coerce_property :videos, collection: VideoItem
|
157
|
+
coerce_key :videos, Array[VideoItem]
|
152
158
|
|
153
159
|
class Stats < Hashie::Trash
|
160
|
+
include Hashie::Extensions::IndifferentAccess
|
154
161
|
property :fetch_time, from: :fetchTime
|
155
162
|
property :confidence
|
156
163
|
end
|
@@ -162,8 +169,7 @@ module Diffbot
|
|
162
169
|
# the text of the article. Between 0.0 and 1.0.
|
163
170
|
#
|
164
171
|
# Only present if you set `stats` to true in the request.
|
165
|
-
|
166
|
-
coerce_property :stats, class: Stats
|
172
|
+
coerce_key :stats, Stats
|
167
173
|
|
168
174
|
# Public: The XPath selector at which the body of the article was found in
|
169
175
|
# the page.
|
@@ -203,6 +209,7 @@ module Diffbot
|
|
203
209
|
property :type
|
204
210
|
|
205
211
|
class RequestParams < Hashie::Trash
|
212
|
+
include Hashie::Extensions::IndifferentAccess
|
206
213
|
# Public: Set to true to return HTML instead of plain-text.
|
207
214
|
#
|
208
215
|
# Defaults to nil.
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Sanguinetti
|
@@ -9,90 +9,104 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ! '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ! '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: yajl-ruby
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ! '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ! '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: nokogiri
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 1.5.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.5.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: hashie
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 3.3.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 3.3.2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bundler
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '1.3'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ~>
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '1.3'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: minitest
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pry
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
89
103
|
- !ruby/object:Gem::Version
|
90
104
|
version: '0'
|
91
105
|
type: :development
|
92
106
|
prerelease: false
|
93
107
|
version_requirements: !ruby/object:Gem::Requirement
|
94
108
|
requirements:
|
95
|
-
- -
|
109
|
+
- - ! '>='
|
96
110
|
- !ruby/object:Gem::Version
|
97
111
|
version: '0'
|
98
112
|
description: Diffbot provides a concise API for analyzing and extracting semantic
|
@@ -104,8 +118,8 @@ executables: []
|
|
104
118
|
extensions: []
|
105
119
|
extra_rdoc_files: []
|
106
120
|
files:
|
107
|
-
-
|
108
|
-
-
|
121
|
+
- .gitignore
|
122
|
+
- .travis.yml
|
109
123
|
- Gemfile
|
110
124
|
- Gemfile.lock
|
111
125
|
- LICENSE
|
@@ -134,17 +148,17 @@ require_paths:
|
|
134
148
|
- lib
|
135
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
150
|
requirements:
|
137
|
-
- -
|
151
|
+
- - ! '>='
|
138
152
|
- !ruby/object:Gem::Version
|
139
153
|
version: '0'
|
140
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
155
|
requirements:
|
142
|
-
- -
|
156
|
+
- - ! '>='
|
143
157
|
- !ruby/object:Gem::Version
|
144
158
|
version: '0'
|
145
159
|
requirements: []
|
146
160
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.4.5
|
148
162
|
signing_key:
|
149
163
|
specification_version: 4
|
150
164
|
summary: Ruby interface to the Diffbot API
|