Class: Japonica::Auction

Inherits:
Object
  • Object
show all
Defined in:
lib/japonica/auction.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_priceObject

Returns the value of attribute current_price.



11
12
13
# File 'lib/japonica/auction.rb', line 11

def current_price
  @current_price
end

#item_nameObject

Returns the value of attribute item_name.



9
10
11
# File 'lib/japonica/auction.rb', line 9

def item_name
  @item_name
end

#max_bidObject

Returns the value of attribute max_bid.



12
13
14
# File 'lib/japonica/auction.rb', line 12

def max_bid
  @max_bid
end

#seller_idObject

Returns the value of attribute seller_id.



10
11
12
# File 'lib/japonica/auction.rb', line 10

def seller_id
  @seller_id
end

#urlObject

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/japonica/auction.rb', line 14

def is_mbok?
	url =~ /mbok\.jp/i
end

#is_yahoo?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/japonica/auction.rb', line 18

def is_yahoo?
	url =~ /yahoo\.co\.jp/i
end