pet_rescue-scraper 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0869a2e7eca1d31e68d6b428c5c470a94c73958
4
- data.tar.gz: 7ac8ef13bcdde87b2cd716ab7bf8e3e9835e5429
3
+ metadata.gz: 54be7848062e5bb60907a0569975e20654f7b63a
4
+ data.tar.gz: 939c3871b89b4a93f7b5e3d89b140a5ff9c4af04
5
5
  SHA512:
6
- metadata.gz: 0be3f54185d3d0d4fb90aef48ac500be43ea1bf94705350c1998ddb49751e620f1a0470671b09c3bb80fcc85cbf22407009b69daec8c7dd648ae7545ebf6efe5
7
- data.tar.gz: d059b42dd88c4d0aab3d00313af90d08eed1346088f218246fb29119f50febbe96411da22216b69dde0cd8c389543264fd9abc73e7b77057c2804c87bec2def7
6
+ metadata.gz: 94f1ff15d60c9bfd9f505e5dd2a0c75634251a3ad560c7e47b068656808dc951839cf137d60a51fcc277da4cb1eaed9e883fd0bfb1e7e224b4f55ade101eaea1
7
+ data.tar.gz: 93298f5821c3869629b5d2bd079b157ffc4e7a57287363774f7162bb434efc12839c9a2f1a800491cf600e0cfa023cb49e4acf1c3bff023352b3adcf4e8a6b95
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # PetRescue::Scraper
1
+ # PetRescue::Scraper [![Circle CI](https://circleci.com/gh/ags/pet_rescue-scraper.png?style=badge)](https://circleci.com/gh/ags/pet_rescue-scraper)
2
2
 
3
- TODO: Write a gem description
3
+ A screen scraper for [petrescue.com.au](http://www.petrescue.com.au/).
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,11 +20,21 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ Currently only scraping dog listings is supported.
24
+
25
+ ```ruby
26
+ require 'pet_rescue/scraper'
27
+
28
+ dog_listings = PetRescue::Scraper::DogListings.new
29
+ dog_listings.take(10).each do |listing_page|
30
+ pet = listing_page.pet
31
+ puts "#{pet.name} - #{pet.breed}"
32
+ end
33
+ ```
24
34
 
25
35
  ## Contributing
26
36
 
27
- 1. Fork it ( https://github.com/[my-github-username]/pet_rescue-scraper/fork )
37
+ 1. Fork it ( https://github.com/ags/pet_rescue-scraper/fork )
28
38
  2. Create your feature branch (`git checkout -b my-new-feature`)
29
39
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
40
  4. Push to the branch (`git push origin my-new-feature`)
data/circle.yml ADDED
@@ -0,0 +1,7 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.1.3
4
+
5
+ dependencies:
6
+ pre:
7
+ - gem install bundler --pre
@@ -22,7 +22,8 @@ module PetRescue
22
22
  adoption_fee: pet_adoption_fee,
23
23
  adoption_process: pet_adoption_process,
24
24
  contact_name: pet_contact_name,
25
- contact_number: pet_contact_number)
25
+ contact_number: pet_contact_number,
26
+ rescued: pet_rescued?)
26
27
  end
27
28
 
28
29
  def pet_name
@@ -93,6 +94,10 @@ module PetRescue
93
94
  photo_node && photo_node.at_css("a").attributes["href"].value
94
95
  end
95
96
 
97
+ def pet_rescued?
98
+ !!@document.at_css(".adopt_this_pet_container .rehomed")
99
+ end
100
+
96
101
  private
97
102
 
98
103
  def photo_node
@@ -22,5 +22,6 @@ module PetRescue
22
22
  attribute :contact_number, String
23
23
  attribute :small_photo_url, String
24
24
  attribute :large_photo_url, String
25
+ attribute :rescued, Boolean
25
26
  end
26
27
  end
@@ -1,5 +1,5 @@
1
1
  module PetRescue
2
2
  module Scraper
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,358 @@
1
+ <!DOCTYPE html>
2
+ <!--[if lt IE 7 ]> <html lang='en' class='ie6 no-js oldie'> <![endif]-->
3
+ <!--[if IEMobile 7 ]> <html lang='en' class='iemob7 no-js oldie'> <![endif]-->
4
+ <!--[if IE 7 ]> <html lang='en' class='ie7 no-js oldie'> <![endif]-->
5
+ <!--[if IE 8 ]> <html lang='en' class='ie8 no-js oldie'> <![endif]-->
6
+ <!--[if IE 9 ]> <html lang='en' class='ie9 no-js oldie'> <![endif]-->
7
+ <!--[if (gt IE 9)|!(IE)]><!--> <html lang='en' class='no-js'> <!--<![endif]-->
8
+ <head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
9
+ <meta charset='utf-8'>
10
+ <title>Jazmine - Small Female Shih Tzu in QLD - PetRescue
11
+ </title>
12
+ <link href="/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
13
+ <link href='http://cdn.petrescue.com.au/uploads/pet_photos/219860_e7e05_340x340.jpg' rel='image_src'>
14
+ <meta content='We have Jazmine in an open plan boarding kennel and the owner of the kennel says that she is the nicest dog he has ever had staying there. Jazmine ...' name='description'>
15
+
16
+ <link href="/assets/application-339bb9cdfdf7da48f8b19302f2e3524d.css" media="all" rel="stylesheet" type="text/css" />
17
+ <link href="/assets/secondary-b77f59b7435b23a203fa92dd941b6987.css" media="all" rel="stylesheet" type="text/css" />
18
+
19
+ <script src="/assets/modernizr-c3fe5867e320146b2ec8807eda3321fe.js" type="text/javascript"></script>
20
+ <script src="http://w.sharethis.com/button/buttons.js" type="text/javascript"></script>
21
+ <script>
22
+ var __st_loadLate=true;
23
+ stLight.options({publisher: "999ee18a-45b3-4e4f-8c53-62f45e1fa414"});
24
+ </script>
25
+
26
+ <!--[if IE 6]>
27
+ <script src="/assets/dd_belatedpng-79ea5b16160a7f4ea3e45ee41b7109c1.js" type="text/javascript"></script>
28
+ <![endif]-->
29
+ <meta content="authenticity_token" name="csrf-param" />
30
+ <meta content="kwYAwkVpgVPZh+o8c2ArIPmg8TWvllViTRstE77fXUg=" name="csrf-token" />
31
+ <script>
32
+ setTimeout(function(){var a=document.createElement("script");
33
+ var b=document.getElementsByTagName("script")[0];
34
+ a.src=document.location.protocol+"//dnn506yrbagrg.cloudfront.net/pages/scripts/0013/9890.js?"+Math.floor(new Date().getTime()/3600000);
35
+ a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
36
+ </script>
37
+ <script>
38
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
39
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
40
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
41
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
42
+
43
+ ga('create', 'UA-288342-1', 'auto'); // Replace with your property ID.
44
+ ga('send', 'pageview');
45
+ </script>
46
+
47
+ </head>
48
+ <body class='public has-sidebar listings listings-show listings-controller show-action'>
49
+ <div id='fb-root'></div>
50
+ <script>
51
+ window.fbAsyncInit = function() {
52
+ FB.init({
53
+ appId: "408746099178659",
54
+ channelUrl: "http://www.petrescue.com.au/channel.html",
55
+ status: true,
56
+ cookie: true,
57
+ xfbml: true
58
+ });
59
+ };
60
+
61
+ (function(d){
62
+ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
63
+ if (d.getElementById(id)) {return;}
64
+ js = d.createElement('script'); js.id = id; js.async = true;
65
+ js.src = "//connect.facebook.net/en_US/all.js";
66
+ ref.parentNode.insertBefore(js, ref);
67
+ }(document));
68
+ </script>
69
+
70
+ <script>
71
+ var googletag = googletag || {};
72
+ googletag.cmd = googletag.cmd || [];
73
+ (function() {
74
+ var gads = document.createElement('script');
75
+ gads.async = true;
76
+ gads.type = 'text/javascript';
77
+ var useSSL = 'https:' == document.location.protocol;
78
+ gads.src = (useSSL ? 'https:' : 'http:') +
79
+ '//www.googletagservices.com/tag/js/gpt.js';
80
+ var node = document.getElementsByTagName('script')[0];
81
+ node.parentNode.insertBefore(gads, node);
82
+ })();
83
+ </script>
84
+
85
+ <!--[if lt IE 8]>
86
+ <div id='browser-upgrade'>
87
+ <div class='inner'>You are using an outdated web browser which is not fully supported by PetRescue.<br />Please consider upgrading to <a href="http://browsehappy.com/" target="_blank">a faster, more secure browser</a>.</div>
88
+ </div>
89
+ <![endif]-->
90
+ <header id='header' role='banner'>
91
+ <div class='wrapper'>
92
+ <h1 id='logo'><a href="/">PetRescue</a></h1>
93
+ <div class='no_user_signed_in' id='current-user'>
94
+ <div class='avatar'></div>
95
+ <div class='name'><a href="/users/sign_in" class="login" data-remote="true">Log In</a></div>
96
+ <a href="/users/sign_up" class="register">Sign Up</a>
97
+ </div>
98
+
99
+ </div>
100
+ </header>
101
+ <nav id='navigation' role='navigation'>
102
+ <div class='wrapper'>
103
+ <ul>
104
+ <li><a href="/">Home</a></li>
105
+ <li>
106
+ <span class='dropdown'>Find A Pet</span>
107
+ <div class='pointer'>
108
+ <ul>
109
+ <li class='dogs'><a href="/listings/dogs">Dogs</a></li>
110
+ <li class='cats'><a href="/listings/cats">Cats</a></li>
111
+ <li class='other'><a href="/listings/other">Other Pets</a></li>
112
+ </ul>
113
+ </div>
114
+ </li>
115
+ <li><a href="/about">About Us</a></li>
116
+ <li><a href="/rescue_directory">Rescue Directory</a></li>
117
+ <li><a href="/library">Library</a></li>
118
+ <li><a href="/faq">FAQ</a></li>
119
+ <li><a href="/get-involved">Get Involved</a></li>
120
+ <li><a href="/contact">Contact</a></li>
121
+ </ul>
122
+
123
+ </div>
124
+ </nav>
125
+
126
+ <div id='content-wrap'>
127
+ <div class="ad-970x90 ad-gts" id="div-gpt-ad-1398134396986-0"></div>
128
+
129
+ <div class='wrapper'>
130
+ <div id='notices'>
131
+ </div>
132
+
133
+ <div id='main'>
134
+
135
+ <h1>
136
+ Jazmine
137
+ </h1>
138
+ <div id='primary'>
139
+ <article id='listing_content'>
140
+ <div class='actions'>
141
+ <div class='add_remove_favourites'><form accept-charset="UTF-8" action="/users/favourites" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="kwYAwkVpgVPZh+o8c2ArIPmg8TWvllViTRstE77fXUg=" /></div><input id="favourites_listing_id219860" name="favourites[listing_id]" type="hidden" value="219860" /><input class="add_to_favourites" name="add_to_favourites" type="submit" value="Favourite" /></form>
142
+ </div>
143
+
144
+ </div>
145
+ <div class='share_listing'>
146
+ <h5>Share</h5>
147
+ <span class='share_button st_facebook_custom'>
148
+ <span class='icon'></span>
149
+ </span>
150
+ <span class='share_button st_twitter_custom'>
151
+ <span class='icon'></span>
152
+ </span>
153
+ <span class='share_button st_googleplus_custom'>
154
+ <span class='icon'></span>
155
+ </span>
156
+ <span class='share_button email_custom' data-link-to='/listings/219860/share'>
157
+ <span class='icon'></span>
158
+ Email
159
+ </span>
160
+ <script>
161
+ var el = document.querySelector(".st_facebook_custom");
162
+ el.setAttribute("displaytext", "Facebook");
163
+ el.setAttribute("st_via", "PetRescue");
164
+ el.setAttribute("st_url", "http://www.petrescue.com.au/listings/219860");
165
+
166
+ var el = document.querySelector(".st_twitter_custom");
167
+ el.setAttribute("displaytext", "Twitter");
168
+ el.setAttribute("st_via", "PetRescue");
169
+ el.setAttribute("st_url", "http://www.petrescue.com.au/listings/219860");
170
+
171
+ var el = document.querySelector(".st_googleplus_custom");
172
+ el.setAttribute("displaytext", "Google +");
173
+ el.setAttribute("st_via", "PetRescue");
174
+ el.setAttribute("st_url", "http://www.petrescue.com.au/listings/219860");
175
+
176
+ var el = document.querySelector(".email_custom");
177
+ el.setAttribute("displaytext", "Email");
178
+ </script>
179
+ <span>
180
+ <a href="/listings/219860/adoption_poster" id="print_adoption_poster" target="_blank">Print Adoption Poster</a>
181
+ </span>
182
+
183
+ </div>
184
+ <h2 class='species'>Small Female Shih Tzu</h2>
185
+ <h4 class='located_in'>Located in Queensland</h4>
186
+ <h5 class='interstate'>Available for interstate adoption</h5>
187
+ <div class='personality'><p>We have Jazmine in an open plan boarding kennel and the owner of the kennel says that she is the nicest dog he has ever had staying there. Jazmine was surrendered to us with Sam when their elderly owner died. We at first thought they should go together but have had them fostered in an open plan kennel situation and have discovered that they have differing needs. Jazmine is really a 'lap dog'' She loves people and would like an owner who is retired and able to spend time with her. She is not a barker or yapper. She would be good with another small dog since she has lived with Sam all her life, but we believe she would also be happy as an only dog if she had someone who would just adore her. She needs a home where she is allowed inside and where she has a garden to potter around in. She needs an owner who can afford to have her groomed and keep her coat tidy. Although her papers say she is Shih Tzu Maltese, we are pretty sure that she is Shih Tzu/Lhasa Apso. Jazmine has lost one owner to age and at 4 years old could live another 12 plus years so please consider this when applying. Because we are close to the NSW/Qld border our animals can go to either state. We require prospective owners to meet a dog and we do not fly or transport animals interstate. </p></div>
188
+ <h4>Adoption Process</h4>
189
+ <div class='adoption_process'><p>Please email Yolana at yassep@bigpond.com or phone 0449 049 136.</p></div>
190
+
191
+
192
+
193
+ <h3>Jazmine ’s details</h3>
194
+ <dl class='pets-details'>
195
+ <dt class='first age'>Age:</dt>
196
+ <dd class='first age'>5 years 8 months</dd>
197
+ <dt class='adoption_fee'>Adoption Fee</dt>
198
+ <dd class='adoption_fee'>$350</dd>
199
+ <dt class='desexed'>Desexed?</dt>
200
+ <dd class='desexed'><span class="boolean-image-true boolean-image-yes">Yes</span></dd>
201
+ <dt class='vaccinated'>Vaccinated?</dt>
202
+ <dd class='vaccinated'><span class="boolean-image-true boolean-image-yes">Yes</span></dd>
203
+ <dt class='wormed'>Wormed?</dt>
204
+ <dd class='wormed'><span class="boolean-image-true boolean-image-yes">Yes</span></dd>
205
+ <dt class='heart_worm_treated'>Heart Worm Treated?</dt>
206
+ <dd class='heart_worm_treated'><span class="boolean-image-true boolean-image-yes">Yes</span></dd>
207
+ <dt class='fostered_by'>Rescue Group:</dt>
208
+ <dd class='fostered_by'><a href="/groups/10441">Friends of the Pound (Tweed) Inc.</a></dd>
209
+ </dl>
210
+ <div class='poster_with_id'>
211
+ <div class='additional_details'>
212
+ <h3 class='animal_id'>
213
+ PetRescue ID:
214
+ <span id='listing_id'>219860</span>
215
+ </h3>
216
+ </div>
217
+ </div>
218
+
219
+
220
+ </article>
221
+ </div>
222
+ <div id='secondary'>
223
+ <div class='adopt_this_pet_container'>
224
+ <span class='rehomed'>This pet has been rehomed!</span>
225
+
226
+ </div>
227
+ <div id='pet_images'>
228
+ <div id='featured_photo'>
229
+ <a href="http://cdn.petrescue.com.au/uploads/pet_photos/219860_e7e05_900x900.jpg" class="fancybox" data-fancybox-group="listing"><img alt="Photo of Jazmine " src="http://cdn.petrescue.com.au/uploads/pet_photos/219860_e7e05_340x340.jpg" /></a>
230
+ </div>
231
+ <ul id='thumbnails'>
232
+ <li>
233
+ <a href="http://cdn.petrescue.com.au/uploads/pet_photos/219860_17f30_900x900.jpg" class="fancybox" data-fancybox-group="listing"><img alt="Photo of Jazmine " src="http://cdn.petrescue.com.au/uploads/pet_photos/219860_17f30_70x70.jpg" /></a>
234
+ </li>
235
+ </ul>
236
+ </div>
237
+
238
+
239
+ <div class="ad-336x280 ad-gts" id="div-gpt-ad-1392619022747-0" margin-bottom="10px"></div>
240
+ <p class='last_updated_at'>Last updated on <time datetime="2013-03-16T11:07:13+08:00">March 16, 2013 11:07</time></p>
241
+ <p class='view_count' id='views'>This listing has been viewed 610 times</p>
242
+ </div>
243
+
244
+
245
+ </div>
246
+ <div id='sidebar'>
247
+ <section class='make-a-donation'>
248
+ <p>PetRescue is a not-for-profit organisation. We rely wholly on the kindness of pet lovers like you to help us save lives. Please donate today.</p>
249
+ <a href="/donate">Make A Donation</a>
250
+ </section>
251
+ <nav class='listing-selection'>
252
+ <h4>Find a pet</h4>
253
+ <ul>
254
+ <li class='dogs'><a href="/listings/dogs">Dogs</a></li>
255
+ <li class='cats'><a href="/listings/cats">Cats</a></li>
256
+ <li class='other'><a href="/listings/other">Other Pets</a></li>
257
+ </ul>
258
+ </nav>
259
+ <section id='find-by-petrescue-id'>
260
+ <form action='#'>
261
+ <label for='animal_id'>PetRescue ID</label>
262
+ <input id='animal_id' placeholder='PetRescue ID' type='text'>
263
+ </form>
264
+ <a href="/what_is_a_petrescue_id?layout=false" class="fancybox">What is a PetRescue ID?</a>
265
+ </section>
266
+
267
+
268
+
269
+ <div class="ad-160x600 ad-gts" id="div-gpt-ad-1371512488971-0"></div>
270
+
271
+ </div>
272
+ </div>
273
+
274
+ </div>
275
+
276
+ <div id='footer'>
277
+ <nav class='footer-navigation' role='navigation'>
278
+ <ul>
279
+ <li><a href="/">Home</a></li>
280
+ <li>
281
+ <span class='dropdown'>Find A Pet</span>
282
+ <div class='pointer'>
283
+ <ul>
284
+ <li class='dogs'><a href="/listings/dogs">Dogs</a></li>
285
+ <li class='cats'><a href="/listings/cats">Cats</a></li>
286
+ <li class='other'><a href="/listings/other">Other Pets</a></li>
287
+ </ul>
288
+ </div>
289
+ </li>
290
+ <li><a href="/about">About Us</a></li>
291
+ <li><a href="/rescue_directory">Rescue Directory</a></li>
292
+ <li><a href="/library">Library</a></li>
293
+ <li><a href="/faq">FAQ</a></li>
294
+ <li><a href="/get-involved">Get Involved</a></li>
295
+ <li><a href="/contact">Contact</a></li>
296
+ </ul>
297
+
298
+ </nav>
299
+ <nav class='footer-sponsors' role='navigation'>
300
+ <div class='all-sponsors'>
301
+ <div class='primary'>
302
+ <h4>Major partners</h4>
303
+ <ul>
304
+ <li>
305
+ <a href="http://www.pedigree.com.au" id="pedigree" target="_blank">Pedigree</a>
306
+ </li>
307
+ </ul>
308
+ </div>
309
+ <div class='secondary'>
310
+ <h4>Partners</h4>
311
+ <ul>
312
+ <li>
313
+ <a href="http://www.jetpets.com.au" id="jetpets" target="_blank">Jetpets</a>
314
+ </li>
315
+ <li>
316
+ <a href="http://www.thefrontiergroup.com.au" id="tfg" target="_blank">The Frontier Group</a>
317
+ </li>
318
+ <li>
319
+ <a href="/our_partners" id="our-sponsors" target="_blank">Find out more about our partners</a>
320
+ </li>
321
+ </ul>
322
+ </div>
323
+ </div>
324
+ </nav>
325
+ <div class='footer-copyright'>
326
+ <div class='copyright-terms-privacy'>
327
+ <small class='copyright'>© PetRescue Ltd 2004 - 2014</small>
328
+ <a href="/terms_of_use">Terms of Use</a>
329
+ <p>&amp;</p>
330
+ <a href="/privacy">Privacy Policy</a>
331
+ </div>
332
+ </div>
333
+ </div>
334
+ <script src="/assets/application-820417cd97b2fc12c79b62c348928d41.js" type="text/javascript"></script>
335
+
336
+ <script type="text/javascript">
337
+ googletag.cmd.push(function(){
338
+ googletag.defineSlot('/4905769/PetRescue_v3_ListingPages_BTF_336x280', [336, 280], 'div-gpt-ad-1392619022747-0').addService(googletag.pubads());googletag.defineSlot('/4905769/PetRescue_v3_BelowNav_ATF_970x90_970x90', [970, 90], 'div-gpt-ad-1398134396986-0').addService(googletag.pubads());googletag.defineSlot('/4905769/PetRescue_v3_Right_ATF_160x600_160x600', [160, 600], 'div-gpt-ad-1371512488971-0').addService(googletag.pubads());
339
+ googletag.pubads().enableSingleRequest();
340
+ googletag.pubads().enableAsyncRendering();
341
+ googletag.enableServices();
342
+ googletag.display('div-gpt-ad-1392619022747-0');googletag.display('div-gpt-ad-1398134396986-0');googletag.display('div-gpt-ad-1371512488971-0');
343
+ });
344
+ </script>
345
+
346
+ <script type="text/javascript">if (!NREUMQ.f) { NREUMQ.f=function() {
347
+ NREUMQ.push(["load",new Date().getTime()]);
348
+ var e=document.createElement("script");
349
+ e.type="text/javascript";
350
+ e.src=(("http:"===document.location.protocol)?"http:":"https:") + "//" +
351
+ "js-agent.newrelic.com/nr-100.js";
352
+ document.body.appendChild(e);
353
+ if(NREUMQ.a)NREUMQ.a();
354
+ };
355
+ NREUMQ.a=window.onload;window.onload=NREUMQ.f;
356
+ };
357
+ NREUMQ.push(["nrfj","beacon-6.newrelic.com","15830f52ae","792648","JldYFkILClQBQk4IWRZMXwxXF0lLDF8W",0,198,new Date().getTime(),"","","","",""]);</script></body>
358
+ </html>
@@ -131,10 +131,18 @@ describe PetRescue::ListingPageParser do
131
131
  expect(pet.contact_number).to eq("0410510308")
132
132
  end
133
133
 
134
- it "returns nil when a contact number is not specified" do
134
+ it "handles the absence of a contact number" do
135
135
  pet = parser.parse(read_fixture("mau.html"))
136
136
 
137
137
  expect(pet.contact_number).to eq(nil)
138
138
  end
139
+
140
+ it "extracts whether the pet has been adopted or not" do
141
+ pet = parser.parse(read_fixture("wyatt.html"))
142
+ expect(pet.rescued?).to eq(false)
143
+
144
+ pet = parser.parse(read_fixture("jazmine.html"))
145
+ expect(pet.rescued?).to eq(true)
146
+ end
139
147
  end
140
148
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pet_rescue-scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Smith
@@ -134,6 +134,7 @@ files:
134
134
  - LICENSE.txt
135
135
  - README.md
136
136
  - Rakefile
137
+ - circle.yml
137
138
  - lib/pet_rescue/listing_page.rb
138
139
  - lib/pet_rescue/listing_page_parser.rb
139
140
  - lib/pet_rescue/pet.rb
@@ -143,6 +144,7 @@ files:
143
144
  - pet_rescue-scraper.gemspec
144
145
  - spec/fixtures/dog_search_first_page.html
145
146
  - spec/fixtures/dog_search_last_page.html
147
+ - spec/fixtures/jazmine.html
146
148
  - spec/fixtures/mau.html
147
149
  - spec/fixtures/muttley.html
148
150
  - spec/fixtures/vcr_cassettes/dogs.yml
@@ -180,6 +182,7 @@ summary: Scraper for petrescue.com.au
180
182
  test_files:
181
183
  - spec/fixtures/dog_search_first_page.html
182
184
  - spec/fixtures/dog_search_last_page.html
185
+ - spec/fixtures/jazmine.html
183
186
  - spec/fixtures/mau.html
184
187
  - spec/fixtures/muttley.html
185
188
  - spec/fixtures/vcr_cassettes/dogs.yml