whos_dated_who 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +62 -0
- data/{LICENSE.txt → LICENSE.md} +1 -1
- data/README.md +245 -55
- data/lib/whos_dated_who/client.rb +3 -1
- data/lib/whos_dated_who/parser.rb +9 -1
- data/lib/whos_dated_who/version.rb +1 -1
- data/spec/acceptance/whos_dated_who_spec.rb +5 -5
- data/spec/fixtures/scarlett_johansson.resp +567 -1882
- data/spec/spec_helper.rb +1 -0
- data/spec/whos_dated_who/parser_spec.rb +2 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c152af8ddc7438e056e2a1369c7d3325310e220
|
4
|
+
data.tar.gz: 726dbdc1e2124ab3c2aaad97944d749f5caa2e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9cf0a43d21181bef7fcb119fbd2337993e048b383a2c5a80ed6c14e09722a4a2898fc6b42439edc1d6d5d1c0b52270e09ab740aea0c36570aca8f6fa57b95a
|
7
|
+
data.tar.gz: 4f9eee074b7c7aec058c4f1ea840c95431654c5bbab5423e0b21995adbfa72fc93f355f3700c9ba574fb5e9037fbccca8143bf5aaa02cc65259d81ee42fde9fe
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.0.0-1.0.2 - Jul 21, 2015
|
4
|
+
|
5
|
+
* Medium-size refactoring, specially in parsing.
|
6
|
+
* Travis build now working flawlessly.
|
7
|
+
* Add API key as secure encrypted ENV var for Travis.
|
8
|
+
* Improve coverage support.
|
9
|
+
* Add `rubocop` and `awesome_print` as development dependencies.
|
10
|
+
* Fix relationship status display in command line tool.
|
11
|
+
* "Long-term relationships" are now marked as "dating".
|
12
|
+
* Rspec formatter is the lovely NyanCat from now on.
|
13
|
+
* Specify Ruby 2 requirement.
|
14
|
+
* Update README with newer examples and usage.
|
15
|
+
* New badges on README!
|
16
|
+
|
17
|
+
## 0.3.1 - Mar 25, 2015
|
18
|
+
|
19
|
+
* Adds acceptance tests to ensure no site changes break the client.
|
20
|
+
* Improve testing.
|
21
|
+
* Small stylistic fixes.
|
22
|
+
|
23
|
+
## 0.2.7, 0.3.0 - Mar 18, 2015
|
24
|
+
|
25
|
+
* Loosen dependencies.
|
26
|
+
* Fix parser due to site updates.
|
27
|
+
* Extract Wikipedia-like description of the person.
|
28
|
+
|
29
|
+
## 0.2.6 - Mar 7, 2015
|
30
|
+
|
31
|
+
* Weight and height coherced into meters and kilograms.
|
32
|
+
* Silence external warnings while running tests.
|
33
|
+
|
34
|
+
## 0.2.5 - Feb 3, 2015
|
35
|
+
|
36
|
+
* Parsing fixes related to banners.
|
37
|
+
|
38
|
+
## 0.2.4 - Jan 31, 2015
|
39
|
+
|
40
|
+
* Parsing fixes.
|
41
|
+
|
42
|
+
## 0.2.3 - Dec 22, 2014
|
43
|
+
|
44
|
+
* Maiden name is now included in biography.
|
45
|
+
* Fixes HTML parsing due to site updates.
|
46
|
+
|
47
|
+
## 0.2.1 - 0.2.2 - Oct 15, 2014
|
48
|
+
|
49
|
+
* Bing Image Search client now takes paremeters.
|
50
|
+
* Bing client API key allows to be configured in `~/whos_dated_who.yml`
|
51
|
+
|
52
|
+
## 0.2.0 - Oct 15, 2014
|
53
|
+
|
54
|
+
* Update to new site and layout changes.
|
55
|
+
|
56
|
+
## 0.1.1 - Sep 23, 2014
|
57
|
+
|
58
|
+
* Fix dating relationship status on parser.
|
59
|
+
|
60
|
+
## 0.1.0 - Jun 18, 2014
|
61
|
+
|
62
|
+
* Initial release.
|
data/{LICENSE.txt → LICENSE.md}
RENAMED
data/README.md
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
# WhosDatedWho
|
2
2
|
|
3
|
-
[![Gem Version](https://
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/whos_dated_who.svg)](http://badge.fury.io/rb/whos_dated_who)
|
4
|
+
[![Build Status](https://img.shields.io/travis/blackxored/whos_dated_who.svg)](https://travis-ci.org/blackxored/whos_dated_who)
|
5
|
+
[![Coverage Status](https://img.shields.io/coveralls/blackxored/whos_dated_who.svg)](https://coveralls.io/r/blackxored/whos_dated_who)
|
6
|
+
[![Dependency Status](https://img.shields.io/gemnasium/blackxored/whos_dated_who.svg)](https://gemnasium.com/blackxored/whos_dated_who)
|
7
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/blackxored/whos_dated_who.svg)](https://codeclimate.com/github/blackxored/whos_dated_who)
|
8
|
+
[![License](https://img.shields.io/github/license/blackxored/whos_dated_who.svg)](http://www.opensource.org/licenses/MIT)
|
4
9
|
|
5
|
-
Unofficial API for http://whosdatedwho.com
|
10
|
+
Unofficial API for http://whosdatedwho.com (now http://famousfix.com).
|
11
|
+
|
12
|
+
This client provides an unofficial client to the service which allows to discover
|
13
|
+
a celebrity's dating status, biography, and more things about their personality
|
14
|
+
and likes.
|
6
15
|
|
7
16
|
## Installation
|
8
17
|
|
@@ -23,68 +32,249 @@ Or install it yourself as:
|
|
23
32
|
Fetch a person:
|
24
33
|
|
25
34
|
```ruby
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
35
|
+
|
36
|
+
2.2.2 (main):0 > client = WhosDatedWho::Client.new
|
37
|
+
=> #<WhosDatedWho::Client:0x007fd0739ded10>
|
38
|
+
2.2.2 (main):0 > client.fetch('Scarlett Johansson')
|
39
|
+
=> {
|
40
|
+
"biography" => {
|
41
|
+
:age => 30,
|
42
|
+
:born_at => "New York City, New York",
|
43
|
+
:born_on => #<Date: 1984-11-22 ((2446027j,0s,0n),+0s,2299161j)>,
|
44
|
+
:brand_endorsements => [
|
45
|
+
[ 0] "Gap (2002)",
|
46
|
+
[ 1] "L'Oreal (2006)",
|
47
|
+
[ 2] "LVMH (2006)",
|
48
|
+
[ 3] "Disney Land Disney Park (2007)",
|
49
|
+
[ 4] "Walt Disney World Disney Park (2007)",
|
50
|
+
[ 5] "Dolce & Gabbana (2010)",
|
51
|
+
[ 6] "(2004) Commercial for Calvin Klein fragrance, \"Eternity Moment\"",
|
52
|
+
[ 7] "(2004) Print ad, Estée Lauder.",
|
53
|
+
[ 8] "(2004-07) Print ads for Louis Vuitton.",
|
54
|
+
[ 9] "(2010) Print ads for Moet Champagne.",
|
55
|
+
[10] "(2011) Print ads for Mango fashion line.",
|
56
|
+
[11] "(November 2013) TV commercial, with Matthew McConaughey, for Dolce & Gabbana The One perfume/colognes."
|
57
|
+
],
|
58
|
+
:brothers => [
|
59
|
+
[0] "Hunter Johansson",
|
60
|
+
[1] "Adrian Johansson",
|
61
|
+
[2] "Christian Johansson"
|
62
|
+
],
|
63
|
+
:build => "Athletic",
|
64
|
+
:claim_to_fame => "Ghost World, Lost in Translation, Match Point, The Black Dahlia",
|
65
|
+
:description => "Scarlett Johansson (dʒoʊˈhænsən joh-HAN-sən; born November 22, 1984) is an American actress, model, and singer. She made her film debut in North (1994)
|
66
|
+
:distinctive_features => [
|
67
|
+
[0] "Her Lips",
|
68
|
+
[1] "Husky Voice"
|
69
|
+
],
|
70
|
+
:dress_size => "6",
|
71
|
+
:ethnicity => "White",
|
72
|
+
:eye_color => "Green",
|
73
|
+
:father => "Karsten Johansson",
|
74
|
+
:favorite_accessories => [
|
75
|
+
[0] "D&G Handbags",
|
76
|
+
[1] "Sunglasses"
|
77
|
+
],
|
78
|
+
:favorite_colors => [
|
79
|
+
[0] "Blue"
|
80
|
+
],
|
81
|
+
:favorite_foods => [
|
82
|
+
[0] "Fried Rice"
|
83
|
+
],
|
84
|
+
:favorite_movies => [
|
85
|
+
[0] "Heat",
|
86
|
+
[1] " [1995]",
|
87
|
+
[2] "Goodfellas",
|
88
|
+
[3] " [1990]",
|
89
|
+
[4] "Mean Streets",
|
90
|
+
[5] " [1973]"
|
91
|
+
],
|
92
|
+
:favorite_places => [
|
93
|
+
[0] "Paris",
|
94
|
+
[1] "London"
|
95
|
+
],
|
96
|
+
:first_name => "Scarlett",
|
97
|
+
:friends => [
|
98
|
+
[0] "Domingo Zapata",
|
99
|
+
[1] "Jeremy Renner",
|
100
|
+
[2] "Clark Gregg",
|
101
|
+
[3] "Sam Claflin"
|
102
|
+
],
|
103
|
+
:full_name_at_birth => "Scarlett Ingrid Johansson",
|
104
|
+
:hair_color => "Dyed Blonde",
|
105
|
+
:height => 1.6,
|
106
|
+
:high_school => "Professional Children`s School in Manhattan, New York City, New York, USA",
|
107
|
+
:last_name => "Johansson",
|
108
|
+
:measurements_inches => "32C-25-36",
|
109
|
+
:middle_name => "Ingrid",
|
110
|
+
:mother => "Melanie Sloan (manager)",
|
111
|
+
:nationality => "American",
|
112
|
+
:occupation => "Actress, Model, Singer, and Director",
|
113
|
+
:occupation_category => "Actress",
|
114
|
+
:other_names => [
|
115
|
+
[0] "Scar",
|
116
|
+
[1] "ScarJo"
|
117
|
+
],
|
118
|
+
:pets => [
|
119
|
+
[0] "Trooper (Cat)",
|
120
|
+
[1] "Maggie (Dog - Chihuahua)"
|
121
|
+
],
|
122
|
+
:religion => "Jewish",
|
123
|
+
:sexuality => "Straight",
|
124
|
+
:shoe_size => "9.5",
|
125
|
+
:sisters => [
|
126
|
+
[0] "Vanessa Johansson",
|
127
|
+
[1] "Fenan Sloan Johansson"
|
128
|
+
],
|
129
|
+
:star_sign => "Scorpio",
|
130
|
+
:talent_agency => [
|
131
|
+
[0] "Creative Artist Agency",
|
132
|
+
[1] "Bailey Brand Management, Inc."
|
133
|
+
],
|
134
|
+
],
|
135
|
+
=> {
|
136
|
+
"biography" => {
|
137
|
+
:age => 30,
|
138
|
+
:born_at => "New York City, New York",
|
139
|
+
:born_on => #<Date: 1984-11-22 ((2446027j,0s,0n),+0s,2299161j)>,
|
140
|
+
:brand_endorsements => [
|
141
|
+
[ 0] "Gap (2002)",
|
142
|
+
[ 1] "L'Oreal (2006)",
|
143
|
+
[ 2] "LVMH (2006)",
|
144
|
+
[ 3] "Disney Land Disney Park (2007)",
|
145
|
+
[ 4] "Walt Disney World Disney Park (2007)",
|
146
|
+
[ 5] "Dolce & Gabbana (2010)",
|
147
|
+
[ 6] "(2004) Commercial for Calvin Klein fragrance, \"Eternity Moment\"",
|
148
|
+
[ 7] "(2004) Print ad, Estée Lauder.",
|
149
|
+
[ 8] "(2004-07) Print ads for Louis Vuitton.",
|
150
|
+
[ 9] "(2010) Print ads for Moet Champagne.",
|
151
|
+
[10] "(2011) Print ads for Mango fashion line.",
|
152
|
+
[11] "(November 2013) TV commercial, with Matthew McConaughey, for Dolce & Gabbana The One perfume/colognes."
|
153
|
+
],
|
154
|
+
:brothers => [
|
155
|
+
[0] "Hunter Johansson",
|
156
|
+
[1] "Adrian Johansson",
|
157
|
+
[2] "Christian Johansson"
|
158
|
+
],
|
159
|
+
:build => "Athletic",
|
160
|
+
:claim_to_fame => "Ghost World, Lost in Translation, Match Point, The Black Dahlia",
|
161
|
+
:description => "Scarlett Johansson (dʒoʊˈhænsən joh-HAN-sən; born November 22, 1984) is an American actress, model, and singer. She made her film debut in North (1994)
|
162
|
+
:distinctive_features => [
|
163
|
+
[0] "Her Lips",
|
164
|
+
[1] "Husky Voice"
|
165
|
+
],
|
166
|
+
:dress_size => "6",
|
167
|
+
:ethnicity => "White",
|
168
|
+
:eye_color => "Green",
|
169
|
+
:father => "Karsten Johansson",
|
170
|
+
:favorite_accessories => [
|
171
|
+
[0] "D&G Handbags",
|
172
|
+
[1] "Sunglasses"
|
173
|
+
],
|
174
|
+
:favorite_colors => [
|
175
|
+
[0] "Blue"
|
176
|
+
],
|
177
|
+
:favorite_foods => [
|
178
|
+
[0] "Fried Rice"
|
179
|
+
],
|
180
|
+
:favorite_movies => [
|
181
|
+
[0] "Heat",
|
182
|
+
[1] " [1995]",
|
183
|
+
[2] "Goodfellas",
|
184
|
+
[3] " [1990]",
|
185
|
+
[4] "Mean Streets",
|
186
|
+
[5] " [1973]"
|
187
|
+
],
|
188
|
+
:favorite_places => [
|
189
|
+
[0] "Paris",
|
190
|
+
[1] "London"
|
191
|
+
],
|
192
|
+
:first_name => "Scarlett",
|
193
|
+
:friends => [
|
194
|
+
[0] "Domingo Zapata",
|
195
|
+
[1] "Jeremy Renner",
|
196
|
+
[2] "Clark Gregg",
|
197
|
+
[3] "Sam Claflin"
|
198
|
+
],
|
199
|
+
:full_name_at_birth => "Scarlett Ingrid Johansson",
|
200
|
+
:hair_color => "Dyed Blonde",
|
201
|
+
:height => 1.6,
|
202
|
+
:high_school => "Professional Children`s School in Manhattan, New York City, New York, USA",
|
203
|
+
:last_name => "Johansson",
|
204
|
+
:measurements_inches => "32C-25-36",
|
205
|
+
:middle_name => "Ingrid",
|
206
|
+
:mother => "Melanie Sloan (manager)",
|
207
|
+
:nationality => "American",
|
208
|
+
:occupation => "Actress, Model, Singer, and Director",
|
209
|
+
:occupation_category => "Actress",
|
210
|
+
:other_names => [
|
211
|
+
[0] "Scar",
|
212
|
+
[1] "ScarJo"
|
213
|
+
],
|
214
|
+
:pets => [
|
215
|
+
[0] "Trooper (Cat)",
|
216
|
+
[1] "Maggie (Dog - Chihuahua)"
|
217
|
+
],
|
218
|
+
:religion => "Jewish",
|
219
|
+
:sexuality => "Straight",
|
220
|
+
:shoe_size => "9.5",
|
221
|
+
:sisters => [
|
222
|
+
[0] "Vanessa Johansson",
|
223
|
+
[1] "Fenan Sloan Johansson"
|
224
|
+
],
|
225
|
+
:star_sign => "Scorpio",
|
226
|
+
:talent_agency => [
|
227
|
+
[0] "Creative Artist Agency",
|
228
|
+
[1] "Bailey Brand Management, Inc."
|
229
|
+
],
|
230
|
+
:websites => [
|
231
|
+
[0] "scarlett-fan.com",
|
232
|
+
[1] "scarlettjohansson.org",
|
233
|
+
[2] "scarlett-online.com",
|
234
|
+
[3] "scarlettalbum.com",
|
235
|
+
[4] "scarlett-web.net",
|
236
|
+
[5] "nndb.com",
|
75
237
|
```
|
76
238
|
|
77
|
-
|
239
|
+
This library takes care of cohercion, whether it's primitives or arrays, and
|
240
|
+
also provides a fluent method-like interface to the fields. Height and weight
|
241
|
+
are measured in meters and kilograms.
|
242
|
+
|
243
|
+
Example:
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
2.2.2 (main):0 > result = _
|
247
|
+
=> ...
|
248
|
+
2.2.2 (main):0 > result.status
|
249
|
+
=> :married
|
250
|
+
2.2.2 (main):0 > result.biography.born_at
|
251
|
+
=> "New York City, New York"
|
252
|
+
2.2.2 (main):0 > result.biography.born_on
|
253
|
+
=> #<Date: 1984-11-22 ((2446027j,0s,0n),+0s,2299161j)>
|
254
|
+
2.2.2 (main):0 > result.biography.distinctive_features
|
255
|
+
=> [
|
256
|
+
[0] "Her Lips",
|
257
|
+
[1] "Husky Voice"
|
258
|
+
]
|
259
|
+
```
|
260
|
+
|
261
|
+
These examples (and this gem) use
|
262
|
+
[awesome_print](https://github.com/michaeldv/awesome_print) for better REPL
|
263
|
+
experience.
|
264
|
+
|
265
|
+
### CLI
|
266
|
+
|
267
|
+
You can also get a summary through the provided command line utility:
|
78
268
|
|
79
269
|
```shell
|
80
270
|
$ whos_dated_who query "Scarlett Johansson"
|
81
|
-
|
82
|
-
Commenced Dating: November 2012, Date Engaged: September 2013
|
271
|
+
married: Scarlett Johansson is married to Romain Dauriac.
|
272
|
+
Commenced Dating: November 2012, Date Engaged: September 2013, Date Married: 1 October 2014
|
83
273
|
```
|
84
274
|
|
85
275
|
## Contributing
|
86
276
|
|
87
|
-
1. Fork it (
|
277
|
+
1. Fork it (https://github.com/blackxored/whos_dated_who/fork)
|
88
278
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
279
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
280
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -17,7 +17,15 @@ module WhosDatedWho
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def extract_bio
|
20
|
-
|
20
|
+
bio_selector = '#rcol .cbox-nopad:nth-child(3)'
|
21
|
+
bio = @doc.css(bio_selector)
|
22
|
+
|
23
|
+
# if it's biography section, skip it
|
24
|
+
if bio.css('#wikitext').size > 0
|
25
|
+
bio = @doc.css(bio_selector.sub('3', '4'))
|
26
|
+
end
|
27
|
+
|
28
|
+
result = parse_bio(bio)
|
21
29
|
result[:description] = @doc.css('#wikitext').text
|
22
30
|
|
23
31
|
@biography = Biography.new(result.symbolize_keys)
|
@@ -11,11 +11,11 @@ describe WhosDatedWho do
|
|
11
11
|
expect(result.biography.last_name).to eq('Swanepoel')
|
12
12
|
expect(result.biography.age).to eq(26)
|
13
13
|
|
14
|
-
result = client.fetch('
|
15
|
-
expect(result.status).to eq(:
|
16
|
-
expect(result.biography.first_name).to eq('
|
17
|
-
expect(result.biography.last_name).to eq('
|
18
|
-
expect(result.biography.age).to eq(
|
14
|
+
result = client.fetch('Jennifer Lawrence')
|
15
|
+
expect(result.status).to eq(:single)
|
16
|
+
expect(result.biography.first_name).to eq('Jennifer')
|
17
|
+
expect(result.biography.last_name).to eq('Lawrence')
|
18
|
+
expect(result.biography.age).to eq(24)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|