Class: Japonica::Auction
- Inherits:
-
Object
- Object
- Japonica::Auction
- Defined in:
- lib/japonica/auction.rb
Instance Attribute Summary collapse
-
#current_price ⇒ Object
Returns the value of attribute current_price.
-
#item_name ⇒ Object
Returns the value of attribute item_name.
-
#max_bid ⇒ Object
Returns the value of attribute max_bid.
-
#seller_id ⇒ Object
Returns the value of attribute seller_id.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.load_url(url) ⇒ Object
Load auction from url.
Instance Method Summary collapse
Instance Attribute Details
#current_price ⇒ Object
Returns the value of attribute current_price.
11 12 13 |
# File 'lib/japonica/auction.rb', line 11 def current_price @current_price end |
#item_name ⇒ Object
Returns the value of attribute item_name.
9 10 11 |
# File 'lib/japonica/auction.rb', line 9 def item_name @item_name end |
#max_bid ⇒ Object
Returns the value of attribute max_bid.
12 13 14 |
# File 'lib/japonica/auction.rb', line 12 def max_bid @max_bid end |
#seller_id ⇒ Object
Returns the value of attribute seller_id.
10 11 12 |
# File 'lib/japonica/auction.rb', line 10 def seller_id @seller_id end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/japonica/auction.rb', line 8 def url @url end |
Class Method Details
.load_url(url) ⇒ Object
Load auction from url
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/japonica/auction.rb', line 23 def self.load_url(url) auction = Auction.new auction.url = url html = fetch_html url if auction.is_mbok? load_mbok html, auction elsif auction.is_yahoo? load_yahoo html, auction else nil end end |
Instance Method Details
#is_mbok? ⇒ Boolean
14 15 16 |
# File 'lib/japonica/auction.rb', line 14 def is_mbok? url =~ /mbok\.jp/i end |
#is_yahoo? ⇒ Boolean
18 19 20 |
# File 'lib/japonica/auction.rb', line 18 def is_yahoo? url =~ /yahoo\.co\.jp/i end |