ebay tradingAPI gem

ANX 6c7f225822 加入顯示json、xml並修正get_order特例錯誤問題 vor 8 Jahren
bin 79257dc514 initial commit vor 10 Jahren
lib 6c7f225822 加入顯示json、xml並修正get_order特例錯誤問題 vor 8 Jahren
spec 79257dc514 initial commit vor 10 Jahren
.gitignore 79257dc514 initial commit vor 10 Jahren
.rspec 79257dc514 initial commit vor 10 Jahren
.travis.yml 79257dc514 initial commit vor 10 Jahren
Gemfile 79257dc514 initial commit vor 10 Jahren
LICENSE.txt 79257dc514 initial commit vor 10 Jahren
README.md d684549407 readme調整 vor 8 Jahren
Rakefile 79257dc514 initial commit vor 10 Jahren
ebaytr.gemspec 3e8d36e058 修正gemspec homepage vor 8 Jahren

README.md

Ebaytr

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/ebaytr. To experiment with that code, run bin/console for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

Installation

Add this line to your application's Gemfile:

gem 'ebaytr'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ebaytr

Usage

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, {})
  ...

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.

License

The gem is available as open source under the terms of the MIT License.