Class: Oass::Client
- Inherits:
-
Object
- Object
- Oass::Client
- Defined in:
- lib/oass/client.rb,
lib/oass/client/campaign.rb,
lib/oass/client/creative.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #request(method) ⇒ Object
Methods included from Creative
#create_creative, #read_creative
Methods included from Campaign
#create_campaign, #read_campaign, #update_campaign
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/oass/client.rb', line 11 def initialize( = {}) .reverse_merge! :endpoint => Oass.endpoint, :account => Oass.account, :username => Oass.username, :password => Oass.password .each_pair do |key, value| send "#{key}=", value end end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
9 10 11 |
# File 'lib/oass/client.rb', line 9 def account @account end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
9 10 11 |
# File 'lib/oass/client.rb', line 9 def endpoint @endpoint end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/oass/client.rb', line 9 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
9 10 11 |
# File 'lib/oass/client.rb', line 9 def username @username end |
Instance Method Details
#request(method) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/oass/client.rb', line 22 def request(method) body = Nokogiri::XML::Builder.new(:encoding => "UTF-8") do |xml| xml.AdXML do xml.Request(:type => method) do yield xml end end end response = Savon::Client.new(endpoint).request :n1, :oas_xml_request, :"xmlns:n1" => "http://api.oas.tfsm.com/" do soap.body = { "String_1" => account, "String_2" => username, "String_3" => password, "String_4" => body.to_xml } end parse(response) end |