whos_dated_who 1.0.2 → 1.0.3

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: 57fb8cf53959214274d707f8b226d4800b379f73
4
- data.tar.gz: 3a163e2b7016507e6503df6ab49d380050289922
3
+ metadata.gz: 6c152af8ddc7438e056e2a1369c7d3325310e220
4
+ data.tar.gz: 726dbdc1e2124ab3c2aaad97944d749f5caa2e8b
5
5
  SHA512:
6
- metadata.gz: 4886b5f357414f76a7d835ae1096c44aef5b81d04c1cfe2a5f8376412e938cf88e0c1e8c670f558a327de28209eaea45131809fb5443e52442ae455adf47ead0
7
- data.tar.gz: 4e5e2e1b7605d064cceb055a909f6e75afcd5ab2302f8c2aa3d472b0e02beb679437824f67dd97efa748804af7bc47f2a6c74299c5992e4991382605c801acaf
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.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Adrian Perez
1
+ Copyright (c) 2015 Adrian Perez
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,8 +1,17 @@
1
1
  # WhosDatedWho
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/whos_dated_who.png)](http://badge.fury.io/rb/whos_dated_who) [![Build Status](https://travis-ci.org/blackxored/whos_dated_who.png)](https://travis-ci.org/blackxored/whos_dated_who) [![Coverage Status](https://coveralls.io/repos/blackxored/whos_dated_who/badge.png?branch=master)](https://coveralls.io/r/blackxored/whos_dated_who) [![Dependency Status](https://gemnasium.com/blackxored/whos_dated_who.png)](https://gemnasium.com/blackxored/whos_dated_who) [![Code Climate](https://codeclimate.com/github/blackxored/whos_dated_who.png)](https://codeclimate.com/github/blackxored/whos_dated_who)
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
- 2.1.1 (main):0> require 'whos_dated_who'
27
- => true
28
- 2.1.1 (main):0> WhosDatedWho::Client.new.fetch('Scarlett Johansson')
29
- => {:biography=>
30
- {:first_name=>"Scarlett",
31
- :middle_name=>"Ingrid",
32
- :last_name=>"Johansson",
33
- :full_name_at_birth=>"Scarlett Ingrid Johansson",
34
- :other_names=>["Scarlett Johanssen", "ScarJo", "Scar"],
35
- :age=>29,
36
- :born_on=>#<Date: 1984-11-22 ((2446027j,0s,0n),+0s,2299161j)>,
37
- :born_at=>"New York, USA",
38
- :height=>"5' 3\" (160 cm)",
39
- :weight=>"120 lbs (54.4 kg)",
40
- :build=>"Voluptuous",
41
- :eye_color=>"Green",
42
- :hair_color=>"Dyed Blonde",
43
- :distinctive_features=>["Bust", "Skin", "Big Lips"],
44
- :star_sign=>"Scorpio",
45
- :sexuality=>"Straight",
46
- :religion=>"Jewish",
47
- :ethnicity=>"White",
48
- :nationality=>"American",
49
- :high_school=>"Professional Children`s School in Manhattan, New York City, New York, USA",
50
- :occupation=>"Actress, Model, Singer",
51
- :occupation_category=>"Actress",
52
- :claim_to_fame=>"Ghost World, Lost in Translation, Match Point, The Black Dahlia",
53
- :talent_agency=>"Creative Artist Agency",
54
- :brand_endorsements=>
55
- ["Gap (2002)", "L'Oreal (2006)", "LVMH (2006)", "Disney Land Disney Park (2007)", "Walt Disney World Disney Park (2007)", "Dolce & Gabbana (2010)"],
56
- :measurements_inches=>"36D-25-36",
57
- :dress_size=>"6",
58
- :shoe_size=>"9",
59
- :websites=>["scarlett-fan.com", "scarlettjohansson.org", "scarlett-online.com", "scarlettalbum.com", "scarlett-web.net"],
60
- :father=>"Karsten Johansson",
61
- :mother=>"Melanie Sloan (manager)",
62
- :brothers=>["Hunter Johansson", "Adrian Johansson", "Christian Johansson"],
63
- :sisters=>["Vanessa Johansson", "Fenan Sloan Johansson"],
64
- :friends=>["Domingo Zapata", "Jeremy Renner", "Clark Gregg", "Sam Claflin"],
65
- :pets=>["Trooper (Cat)", "Maggie (Dog - Chihuahua)"],
66
- :favorite_movies=>["Heat [1995]"],
67
- :favorite_places=>["Paris", "London"],
68
- :favorite_foods=>["Fried Rice"],
69
- :favorite_colors=>["Blue"],
70
- :favorite_accessories=>["D&G Handbags", "Sunglasses"]},
71
- :status=>:engaged,
72
- :current_relationship=>
73
- {"human"=>"Scarlett Johansson is engaged to Romain Dauriac.", "dates"=>["Commenced Dating: November 2012", "Date Engaged: September 2013"]}}
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
- Or get a summary through the command line:
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
- engaged: Scarlett Johansson is engaged to Romain Dauriac.
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 ( https://github.com/[my-github-username]/whos_dated_who/fork )
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`)
@@ -5,7 +5,9 @@ module WhosDatedWho
5
5
  url = bing_results.first[:Web].first[:Url]
6
6
  resp = Faraday.get(url)
7
7
 
8
- resp.success? && Parser.new.parse(resp.body)
8
+ if resp.success?
9
+ Parser.new.parse(resp.body)
10
+ end
9
11
  end
10
12
  end
11
13
  end
@@ -17,7 +17,15 @@ module WhosDatedWho
17
17
  private
18
18
 
19
19
  def extract_bio
20
- result = parse_bio(@doc.css('#rcol .cbox-nopad:nth-child(3)'))
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)
@@ -1,3 +1,3 @@
1
1
  module WhosDatedWho
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -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('Katheryn Winnick')
15
- expect(result.status).to eq(:unknown)
16
- expect(result.biography.first_name).to eq('Katheryn')
17
- expect(result.biography.last_name).to eq('Winnick')
18
- expect(result.biography.age).to eq(37)
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