SipUtils:アリソフトウェアSIPプラットフォーム(サービス統合プラットフォーム)にアクセスするRubyサードパーティツール


SipUtils? is a helper , for agile accessing the api @ AliSoft? SIP(Services Integration Platform)
SipUtils? アリソフトウェアSIPプラットフォーム(サービス統合プラットフォーム)にアクセスするRubyサードパーティライブラリであり、SIPプラットフォームが開いているインタフェースを非常に便利で迅速に使用することができます.
現在、Gemは測定段階にありますので、ご連絡ください.
------CharlesCui?@Alisoft
[MSN:[email protected]] [Email:[email protected]]
インストール方法:
まずDownloads(
http://code.google.com/p/siputils/)ページSipUtilsをダウンロードしますか?のGemファイルをダウンロードしてそのファイルのあるディレクトリに入り、コマンドライン実行:gem install SipUtils?gem -l
使用説明:このGemがインストールされると、Ruby_が表示されます.Home?\gems\1.8\gems\SipUtils?testディレクトリのテストファイルを実行してみてください.要求を正しく返すことができれば、インストールに成功し、使用可能であることを示します.
テストコード:本コードはタオバオのtaobaoをテストします.user.getインタフェースは、ビジネスパラメータが{:nick=>「cuizhenghz」、:v=>「1.0」}であり、cuizhenghzというアカウントの淘宝での個人情報を得る.
require 'rubygems' 
dir = File.expand_path(File.join(File.dirname(FILE), '..', 'lib')) 
require File.join(dir, 'SIPUtils') 
require 'pp'

include SipGenerator

evalClient("SIP") 
@sipUrl="http://sip.alisoft.com/sip/rest"; 
@options={:sip_appkey=>"20786", :sip_apiname=>"taobao.user.get", :sip_sessionid=>SIP.getSessionId, :sip_appsecret=>"2413bce0de3111ddb2d6d2f4590e509c" ,:tokenttl=>"10"} 
@options.update({:fields=>"created,nick,real_name,sex,location,buyer_credit,seller_credit,phone,mobile,email,birthday,last_visit"}) 
@options.update({:nick=>"cuizhenghz",:v=>"1.0"})

response=SIP.sipRequest(@options,{:url=>@sipUrl})

header=response.header 
p header["sip_status"]#expect "9999"

body=Hash.from_xml response.body 
p body["rsp"]["user"]["sex"]#expect "m"