twingly-search 5.1.4 → 5.2.0
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +2 -2
- data/lib/twingly/livefeed/post.rb +26 -0
- data/lib/twingly/livefeed/version.rb +1 -1
- data/lib/twingly/search/post.rb +26 -0
- data/lib/twingly/search/version.rb +1 -1
- data/spec/livefeed/post_spec.rb +47 -0
- data/spec/post_spec.rb +48 -0
- data/twingly-search-api-ruby.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3183abe585817948bbaa2b8c196c819861e1bf605ea84e0df3993b574dd056da
|
4
|
+
data.tar.gz: 6d9467ae4f7b961ce8084a6a18f2df5081fd5067d32f246ceba3b9a9ff25213b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81aef4a30e435c318207a3fd7c89503c876fcbe505dbd87ac87abb8f6fedb0a16a08fb882e99b3069be6c6391774311e1d8ea87e47457db1b0e5577cc6edef96
|
7
|
+
data.tar.gz: 5bf47a6e3ca598356d97ebc7d5c7584579afa2d018f4024465bd75097d06864e4af4f8d0771b67fd88af67a2dea08607933c54918bf3a25b292fd3af71c32738
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v5.1.4](https://github.com/twingly/twingly-search-api-ruby/tree/v5.1.4) (2018-02-23)
|
4
|
+
[Full Changelog](https://github.com/twingly/twingly-search-api-ruby/compare/v5.1.3...v5.1.4)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- Looser requirement on Faraday [\#70](https://github.com/twingly/twingly-search-api-ruby/issues/70)
|
9
|
+
|
10
|
+
**Fixed bugs:**
|
11
|
+
|
12
|
+
- Update yard gem dependency [\#72](https://github.com/twingly/twingly-search-api-ruby/issues/72)
|
13
|
+
|
14
|
+
**Merged pull requests:**
|
15
|
+
|
16
|
+
- Looser requirements on Faraday [\#74](https://github.com/twingly/twingly-search-api-ruby/pull/74) ([jage](https://github.com/jage))
|
17
|
+
- Test with latest Ruby versions [\#73](https://github.com/twingly/twingly-search-api-ruby/pull/73) ([dentarg](https://github.com/dentarg))
|
18
|
+
- Test with latest rubies, support Ruby 2.4 and JRuby 9.1 [\#71](https://github.com/twingly/twingly-search-api-ruby/pull/71) ([walro](https://github.com/walro))
|
19
|
+
|
3
20
|
## [v5.1.3](https://github.com/twingly/twingly-search-api-ruby/tree/v5.1.3) (2017-10-16)
|
4
21
|
[Full Changelog](https://github.com/twingly/twingly-search-api-ruby/compare/v5.1.2...v5.1.3)
|
5
22
|
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ To learn more about the features of this gem, read the [gem documentation] or ch
|
|
27
27
|
|
28
28
|
To learn more about the capabilities of Twingly's APIs, please read the [Blog Search API documentation] and [Blog LiveFeed API documentation].
|
29
29
|
|
30
|
-
[gem documentation]:
|
30
|
+
[gem documentation]: https://www.rubydoc.info/github/twingly/twingly-search-api-ruby
|
31
31
|
[Blog Search API documentation]: https://developer.twingly.com/resources/search/
|
32
32
|
[Blog LiveFeed API documentation]: https://developer.twingly.com/resources/livefeed/
|
33
33
|
|
@@ -106,4 +106,4 @@ This gem is documented using [YARD]. To start a local YARD server run:
|
|
106
106
|
|
107
107
|
The YARD server reloads the documentation automatically so there is no need to restart it when making changes.
|
108
108
|
|
109
|
-
[YARD]:
|
109
|
+
[YARD]: https://yardoc.org/
|
@@ -61,6 +61,32 @@ module Twingly
|
|
61
61
|
@blog_rank = params.fetch('blogRank').to_i
|
62
62
|
@authority = params.fetch('authority').to_i
|
63
63
|
end
|
64
|
+
|
65
|
+
# @return [Hash] a hash containing all post attributes.
|
66
|
+
def to_h
|
67
|
+
{
|
68
|
+
id: @id,
|
69
|
+
author: @author,
|
70
|
+
url: @url,
|
71
|
+
title: @title,
|
72
|
+
text: @text,
|
73
|
+
language_code: @language_code,
|
74
|
+
location_code: @location_code,
|
75
|
+
coordinates: @coordinates,
|
76
|
+
links: @links,
|
77
|
+
tags: @tags,
|
78
|
+
images: @images,
|
79
|
+
indexed_at: @indexed_at,
|
80
|
+
published_at: @published_at,
|
81
|
+
reindexed_at: @reindexed_at,
|
82
|
+
inlinks_count: @inlinks_count,
|
83
|
+
blog_id: @blog_id,
|
84
|
+
blog_name: @blog_name,
|
85
|
+
blog_url: @blog_url,
|
86
|
+
blog_rank: @blog_rank,
|
87
|
+
authority: @authority,
|
88
|
+
}
|
89
|
+
end
|
64
90
|
end
|
65
91
|
end
|
66
92
|
end
|
data/lib/twingly/search/post.rb
CHANGED
@@ -84,6 +84,32 @@ module Twingly
|
|
84
84
|
warn "[DEPRECATION] `outlinks` is deprecated. Please use `links` instead."
|
85
85
|
links
|
86
86
|
end
|
87
|
+
|
88
|
+
# @return [Hash] a hash containing all post attributes.
|
89
|
+
def to_h
|
90
|
+
{
|
91
|
+
id: @id,
|
92
|
+
author: @author,
|
93
|
+
url: @url,
|
94
|
+
title: @title,
|
95
|
+
text: @text,
|
96
|
+
language_code: @language_code,
|
97
|
+
location_code: @location_code,
|
98
|
+
coordinates: @coordinates,
|
99
|
+
links: @links,
|
100
|
+
tags: @tags,
|
101
|
+
images: @images,
|
102
|
+
indexed_at: @indexed_at,
|
103
|
+
published_at: @published_at,
|
104
|
+
reindexed_at: @reindexed_at,
|
105
|
+
inlinks_count: @inlinks_count,
|
106
|
+
blog_id: @blog_id,
|
107
|
+
blog_name: @blog_name,
|
108
|
+
blog_url: @blog_url,
|
109
|
+
blog_rank: @blog_rank,
|
110
|
+
authority: @authority,
|
111
|
+
}
|
112
|
+
end
|
87
113
|
end
|
88
114
|
end
|
89
115
|
end
|
data/spec/livefeed/post_spec.rb
CHANGED
@@ -23,4 +23,51 @@ module Twingly::LiveFeed
|
|
23
23
|
it { should respond_to :blog_rank }
|
24
24
|
it { should respond_to :authority }
|
25
25
|
end
|
26
|
+
|
27
|
+
describe "#to_h" do
|
28
|
+
let(:post) do
|
29
|
+
document = Fixture.livefeed_get(:valid)
|
30
|
+
result = Parser.new.parse(document)
|
31
|
+
|
32
|
+
result.posts.first
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:post_hash) do
|
36
|
+
post.to_h
|
37
|
+
end
|
38
|
+
|
39
|
+
attributes = %i[
|
40
|
+
id
|
41
|
+
author
|
42
|
+
url
|
43
|
+
title
|
44
|
+
text
|
45
|
+
location_code
|
46
|
+
language_code
|
47
|
+
coordinates
|
48
|
+
links
|
49
|
+
tags
|
50
|
+
images
|
51
|
+
indexed_at
|
52
|
+
published_at
|
53
|
+
reindexed_at
|
54
|
+
inlinks_count
|
55
|
+
blog_id
|
56
|
+
blog_name
|
57
|
+
blog_url
|
58
|
+
blog_rank
|
59
|
+
authority
|
60
|
+
]
|
61
|
+
|
62
|
+
it do
|
63
|
+
expect(post_hash.keys).to match_array(attributes)
|
64
|
+
end
|
65
|
+
|
66
|
+
attributes.each do |key|
|
67
|
+
describe "#to_h[:#{key}]" do
|
68
|
+
subject { post_hash[key] }
|
69
|
+
it { is_expected.to eq(post.public_send(key)) }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
26
73
|
end
|
data/spec/post_spec.rb
CHANGED
@@ -23,6 +23,7 @@ describe Post do
|
|
23
23
|
it { should respond_to :blog_url }
|
24
24
|
it { should respond_to :blog_rank }
|
25
25
|
it { should respond_to :authority }
|
26
|
+
it { should respond_to :to_h }
|
26
27
|
|
27
28
|
deprecated_methods = %i(summary indexed published outlinks)
|
28
29
|
deprecated_methods.each do |method_name|
|
@@ -33,4 +34,51 @@ describe Post do
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
38
|
+
describe "#to_h" do
|
39
|
+
let(:post) do
|
40
|
+
document = Fixture.get(:minimal_valid)
|
41
|
+
result = Parser.new.parse(document)
|
42
|
+
|
43
|
+
result.posts.first
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:post_hash) do
|
47
|
+
post.to_h
|
48
|
+
end
|
49
|
+
|
50
|
+
attributes = %i[
|
51
|
+
id
|
52
|
+
author
|
53
|
+
url
|
54
|
+
title
|
55
|
+
text
|
56
|
+
location_code
|
57
|
+
language_code
|
58
|
+
coordinates
|
59
|
+
links
|
60
|
+
tags
|
61
|
+
images
|
62
|
+
indexed_at
|
63
|
+
published_at
|
64
|
+
reindexed_at
|
65
|
+
inlinks_count
|
66
|
+
blog_id
|
67
|
+
blog_name
|
68
|
+
blog_url
|
69
|
+
blog_rank
|
70
|
+
authority
|
71
|
+
]
|
72
|
+
|
73
|
+
it do
|
74
|
+
expect(post_hash.keys).to match_array(attributes)
|
75
|
+
end
|
76
|
+
|
77
|
+
attributes.each do |key|
|
78
|
+
describe "#to_h[:#{key}]" do
|
79
|
+
subject { post_hash[key] }
|
80
|
+
it { is_expected.to eq(post.public_send(key)) }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
36
84
|
end
|
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "nokogiri", "~> 1.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3"
|
25
25
|
spec.add_development_dependency "rspec-its", "~> 1"
|
26
|
-
spec.add_development_dependency "vcr", "~>
|
27
|
-
spec.add_development_dependency "webmock", "~>
|
26
|
+
spec.add_development_dependency "vcr", "~> 4.0"
|
27
|
+
spec.add_development_dependency "webmock", "~> 3.4"
|
28
28
|
spec.add_development_dependency "rake", "~> 11"
|
29
29
|
spec.add_development_dependency "yard", [">= 0.9.11", "< 1.0.0"]
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twingly-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Twingly AB
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -78,28 +78,28 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '4.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '4.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: webmock
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '3.4'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '3.4'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rake
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.7.
|
224
|
+
rubygems_version: 2.7.6
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
227
|
summary: Ruby API client for Twingly Search
|