ioffer 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -11,5 +11,4 @@ group :development do
11
11
  gem 'ore-tasks', '~> 0.4'
12
12
  gem 'rspec', '~> 2.4'
13
13
  gem 'yard', '~> 0.6.0'
14
- gem 'bluecloth', '~> 2.1.0'
15
14
  end
data/README.md CHANGED
@@ -18,27 +18,27 @@ Features
18
18
  Examples
19
19
  --------
20
20
 
21
- require 'ioffer'
22
- require 'open-uri'
23
-
24
- search = IOfferSearch.parse open("http://www.ioffer.com/si/saxphones")
25
-
26
- search.results.each do |result|
27
- puts result.title
28
- puts result.url
29
- end
30
-
31
- result_url = search.results.first.url
32
-
33
- page = IOfferPage.parse open(result_url)
34
- puts page.seller_name
35
- puts page.item_id
36
- puts page.price
21
+ require 'ioffer'
22
+ require 'open-uri'
23
+
24
+ search = IOfferSearch.parse open("http://www.ioffer.com/si/saxphones")
25
+
26
+ search.results.each do |result|
27
+ puts result.title
28
+ puts result.url
29
+ end
30
+
31
+ result_url = search.results.first.url
32
+
33
+ page = IOfferPage.parse open(result_url)
34
+ puts page.seller_name
35
+ puts page.item_id
36
+ puts page.price
37
37
 
38
38
  Install
39
39
  -------
40
40
 
41
- $ gem install ioffer
41
+ $ gem install ioffer
42
42
 
43
43
  Todo
44
44
  ----
@@ -1,8 +1,8 @@
1
1
  require 'nibbler'
2
2
 
3
- require 'ioffer/version'
4
- require 'ioffer/search'
5
- require 'ioffer/page'
3
+ require_relative 'ioffer/version'
4
+ require_relative 'ioffer/search'
5
+ require_relative 'ioffer/page'
6
6
 
7
7
  module Ioffer
8
8
  end
@@ -3,16 +3,16 @@ require 'date'
3
3
  require 'sanitize'
4
4
 
5
5
  class IOfferPage < Nibbler
6
- element 'div#itemDetailSellerName a[href^="/users/"]' => :seller_name
6
+ element 'div.sellerInfo span.seller a[href^="http://www.ioffer.com/users/"]' => :seller_name
7
7
  element 'div[@id="header-status-bar"]' => :item_id, :with => lambda { |element| parse_item_id(element) }
8
8
  element 'div[@id="header-status-bar"]' => :posted_on, :with => lambda { |element| parse_posted_date(element) }
9
- element 'div.primary-action-cell span[id^=price]' => :price, :with => lambda { |element| make_price(element) }
10
- element "//div[@id='item_description_description_p']" => :description, :with => lambda { |element| parse_description(element.to_html) }
9
+ element '//div[@class="actions"]/span[@class="price"]/span/@data-original-price' => :price# , :with => lambda { |element| make_price(element) }
10
+ element "//div[@id='postFold']//div[@id='description']" => :description, :with => lambda { |element| parse_description(element.to_html) }
11
11
  end
12
12
 
13
- def make_price(element)
14
- /\$([\d,]+\.?[\d]{2})/.match(element)[1]
15
- end
13
+ # def make_price(element)
14
+ # /\$([\d,]+\.?[\d]{2})/.match(element)[1]
15
+ # end
16
16
 
17
17
  def parse_item_id(element)
18
18
  /Item #([\d]*)/.match(element.inner_text)[1]
@@ -4,8 +4,7 @@ class IOfferSearchResults < Nibbler
4
4
  end
5
5
 
6
6
  class IOfferSearch < Nibbler
7
- elements 'div.search-results-list-item' => :results,
8
- :with => IOfferSearchResults
7
+ elements 'div.search-results-list-item' => :results, :with => IOfferSearchResults
9
8
  element 'span[@class="current"]' => :current_page
10
9
  element 'a[@class="next_page"]/@href' => :next_page_url
11
10
  end
@@ -1,4 +1,4 @@
1
1
  module Ioffer
2
2
  # ioffer version
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ioffer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ezekiel Templin
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-14 00:00:00 Z
13
+ date: 2011-05-03 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nibbler