Browse Source

readme調整

ANX 6 years ago
parent
commit
d684549407
2 changed files with 34 additions and 2 deletions
  1. 33 1
      README.md
  2. 1 1
      lib/ebaytr/version.rb

+ 33 - 1
README.md

@@ -23,8 +23,17 @@ Or install it yourself as:
 ## Usage
 
 ```
-Ebaytr.token = "xxxx"
+Ebaytr.token = 'xxx' 
+Ebaytr.app_name = 'xxxx' 
+Ebaytr.dev_name = 'xxxx' 
+Ebaytr.cert_name = 'xxxx' 
+Ebaytr.env = "development"
 Ebaytr.url = "https://api.sandbox.ebay.com/ws/api.dll"
+Ebaytr.api = "967"
+Ebaytr.site = "US"
+Ebaytr.global_id = "EBAY-US"
+Ebaytr.url = "https://api.sandbox.ebay.com/ws/api.dll"
+
 @ebay_json = Ebaytr.trading(:GetItem, ItemID: '101010101010')
 @ebay_json = Ebaytr.trading(:AddItem, {})
 @ebay_json = Ebaytr.trading(:ReviseItem, {})
@@ -32,6 +41,29 @@ Ebaytr.url = "https://api.sandbox.ebay.com/ws/api.dll"
 
 ```
 
+
+you can use a method to change site or other attributes
+
+```
+def set_site(**args)
+    Ebaytr.site = args[:site]
+    Ebaytr.env = Rails.env
+    Ebaytr.app_name = ENV["ebay_#{Rails.env}_app_name"]
+    Ebaytr.dev_name = ENV["ebay_#{Rails.env}_dev_name"]
+    Ebaytr.cert_name = ENV["ebay_#{Rails.env}_cert_name"]
+    Ebaytr.token = EbayToken.find_by(site: Ebaytr.site).try:auth_token) || ENV["ebay_#{Rails.env}_#{Ebaytr.site}"]
+end
+
+set_site(site: 'US')
+@ebay_json = Ebaytr.trading(:GetItem, ItemID: '101010101010')
+
+set_site(site: 'AU')
+@ebay_json = Ebaytr.trading(:AddItem, {})
+
+set_site(site: 'Australia')
+@ebay_json = Ebaytr.trading(:ReviseItem, {})
+```
+
 ## Contributing
 
 Bug reports and pull requests are welcome on GitHub at https://github.com/anxgang/ebaytr.

+ 1 - 1
lib/ebaytr/version.rb

@@ -1,3 +1,3 @@
 module Ebaytr
-  VERSION = "1.3.2"
+  VERSION = "1.3.3"
 end