add red test
remove debug log
[from now] 2013/02/18 18:41:21

diff --git a/lib/android_market_api/android_market.rb b/lib/android_market_api/android_market.rb
index e1f4c2f..177ed88 100644
--- a/lib/android_market_api/android_market.rb
+++ b/lib/android_market_api/android_market.rb
@@ -18,11 +18,12 @@ class AndroidMarket
 @@languages=Array.[]('en','pt_PT','pt_BR','es','es_419','fr','it','es')

   def AndroidMarket.get_top_selling_free_app_in_category(category,position,language='en')
-    url="https://market.android.com/details?id=apps_topselling_free&cat="+category+"&start="+(position-1).to_s+"&num=24&hl="+language
+    url = "https://play.google.com/store/apps/collection/topselling_free?start=#{position-1}&num=24&hl=#{language}"
     doc = Hpricot(open(url,'User-Agent' => 'ruby'))
-    buy_div=doc.search("//div[@class='buy-border']//a").first
-    puts "Getting Application package "+buy_div.attributes['data-docid']
-    app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
+    buy_div=doc.search("//li[@class='goog-inline-block']").first
+    package = buy_div.attributes['data-docid']
+    puts "Getting Application package "+package
+    app=AndroidMarketApplication.new(package,language)
     return app
   end

diff --git a/spec/android_market_spec.rb b/spec/android_market_spec.rb
index fb11e3c..5becdd8 100644
--- a/spec/android_market_spec.rb
+++ b/spec/android_market_spec.rb
@@ -10,13 +10,13 @@ describe AndroidMarket do
     it{ should include "BOOKS_AND_REFERENCE" }
   end

-  let(:category) { "BOOKS_AND_REFERENCE" }
+  let(:category) { "books" }
   let(:position) { 1 }
   let(:language) { "en" }

   describe "#get_top_selling_free_app_in_category" do
     subject { AndroidMarket.get_top_selling_free_app_in_category(category, position, language) }

-    it{ should have_at_least(1).items }
+    it{ should an_instance_of AndroidMarketApplication }
   end
 end
\ No newline at end of file
Merge branch 'master' into develop
bugfix: typo
impl get_top_selling_free_app_in_category
add red test
impl get_top_selling_paid_app_in_category
add red test
impl get_overall_top_selling_free_app
add red test
impl get_overall_top_selling_paid_app
add test: get_developer_app_list
refactor: indent
add debug flag
refactor: remove unused param
add tests
refactor
refactor: exract to method
Merge branch 'develop'