Class: Oass::Client

Inherits:
Object
  • Object
show all
Includes:
Campaign, Creative
Defined in:
lib/oass/client.rb,
lib/oass/client/campaign.rb,
lib/oass/client/creative.rb

Defined Under Namespace

Modules: Campaign, Creative

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  options.reverse_merge! :endpoint => Oass.endpoint,
                         :account  => Oass.,
                         :username => Oass.username,
                         :password => Oass.password

  options.each_pair do |key, value|
    send "#{key}=", value
  end
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



9
10
11
# File 'lib/oass/client.rb', line 9

def 
  @account
end

#endpointObject

Returns the value of attribute endpoint.



9
10
11
# File 'lib/oass/client.rb', line 9

def endpoint
  @endpoint
end

#passwordObject

Returns the value of attribute password.



9
10
11
# File 'lib/oass/client.rb', line 9

def password
  @password
end

#usernameObject

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" => ,
      "String_2" => username,
      "String_3" => password,
      "String_4" => body.to_xml
    }
  end

  parse(response)
end