Class: Rpx::Client
- Inherits:
-
Object
- Object
- Rpx::Client
- Defined in:
- lib/rpx/client.rb
Constant Summary collapse
- NAMESPACES =
{ "xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:tem"=>"http://tempuri.org/" }
Instance Method Summary collapse
- #add_attributes_if_present(xml, options, attributes) ⇒ Object
- #api_call(action_name, options) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Method Details
#add_attributes_if_present(xml, options, attributes) ⇒ Object
13 14 15 16 17 |
# File 'lib/rpx/client.rb', line 13 def add_attributes_if_present(xml, , attributes) return add_attributes_if_present(xml, , [attributes]) unless attributes.is_a? Array attributes.each{ |attribute| xml.tem(attribute, [attribute]) if [attribute] } end |
#api_call(action_name, options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rpx/client.rb', line 19 def api_call(action_name, ) raw_response = client.request action_name do soap.xml do |xml| xml.soapenv :Envelope, NAMESPACES do |xml| xml.soapenv :Header xml.soapenv :Body do |xml| xml.tem action_name do |xml| xml.tem :auth do |xml| xml.tem :siteid, .fetch(:siteid) xml.tem :pmcid, .fetch(:pmcid) xml.tem :username, Rpx.config.username xml.tem :password, Rpx.config.password xml.tem :licensekey, Rpx.config.licensekey end yield(xml) end end end end end resident_list_from_raw({ action_name: action_name, raw_response: raw_response }) end |