Browse Source

修正查無site

ANX 6 years ago
parent
commit
8f2e0a4212
2 changed files with 7 additions and 2 deletions
  1. 6 1
      lib/ebaytr.rb
  2. 1 1
      lib/ebaytr/version.rb

+ 6 - 1
lib/ebaytr.rb

@@ -30,7 +30,12 @@ module Ebaytr
     https = Net::HTTP.new(url.host,url.port)
     https.use_ssl = true
     req = Net::HTTP::Post.new(url.path)
-    site_id = site_map.select{|x| x[:site_code]==@@site }[0][:site_id]
+
+    #取得站點ID
+    fetch_site = site_map.select{|x| x[:site_code]==@@site }  
+    puts "查無此站點: #{@@site}"  if fetch_site.size==0
+    site_id = fetch_site[0][:site_id]
+
     req.add_field("X-EBAY-API-SITEID", site_id)
     req.add_field("X-EBAY-API-COMPATIBILITY-LEVEL", @@api)
     req.add_field("X-EBAY-API-CALL-NAME", request_name)

+ 1 - 1
lib/ebaytr/version.rb

@@ -1,3 +1,3 @@
 module Ebaytr
-  VERSION = "1.3.0"
+  VERSION = "1.3.1"
 end