oass 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in propaganda.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'rspec'
8
+ gem 'webmock'
9
+ gem 'vcr'
10
+ end
@@ -0,0 +1,33 @@
1
+ # O_ass_
2
+ Oass is a library to help you to interact with OAS and its bizarre soap API.
3
+
4
+ ## Installation
5
+ gem install oass
6
+
7
+ ## Configuration
8
+ Add global configurations directly to the Oass module:
9
+
10
+ Oass.configure do |config|
11
+ config.endpoint = "The wsdl endpoint"
12
+ config.account = "Your OAS account"
13
+ config.username = "LOL"
14
+ config.password = "WUT"
15
+ end
16
+
17
+ You can override any settings when you instantiate a new client
18
+
19
+ client = Oass::Client.new :username => "Other", :password => "Secret"
20
+
21
+ ## Usage
22
+ client = Oass::Client.new
23
+ campaign = client.read_campaign("campaign_id")
24
+
25
+ You can also make requests that are not yet natively implemented
26
+
27
+ client.request "Campaign" do |xml|
28
+ xml.Campaign(:action => "list") do
29
+ xml.SearchCriteria do
30
+ xml.Status "L"
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,24 @@
1
+ require 'active_support/core_ext/module/attribute_accessors'
2
+ require 'active_support/core_ext/hash/reverse_merge'
3
+ require 'savon'
4
+ require 'oass/errors'
5
+
6
+ module Oass
7
+ autoload :Client, "oass/client"
8
+ autoload :Campaign, "oass/campaign"
9
+ autoload :Creative, "oass/creative"
10
+
11
+ mattr_accessor :endpoint
12
+ @@endpoint = "https://training7.247realmedia.com//oasapi/OaxApi?wsdl"
13
+
14
+ mattr_accessor :account
15
+ @@account = "OasDefault"
16
+
17
+ mattr_accessor :username
18
+
19
+ mattr_accessor :password
20
+
21
+ def configure
22
+ yield self
23
+ end
24
+ end
@@ -0,0 +1,35 @@
1
+ module Oass
2
+ module Campaign
3
+ def read_campaign(id)
4
+ request "Campaign" do |xml|
5
+ xml.Campaign(:action => "read") do
6
+ xml.Overview { xml.Id id }
7
+ end
8
+ end
9
+ end
10
+
11
+ def create_campaign(attributes)
12
+ request "Campaign" do |xml|
13
+ xml.Campaign(:action => "add") do
14
+ xml.Overview do
15
+ # Yeah... the attributes must be in the right order =/
16
+ xml.Id attributes[:id]
17
+ xml.AdvertiserId attributes[:advertiser_id]
18
+ xml.Name attributes[:name]
19
+ xml.AgencyId attributes[:agency_id]
20
+ xml.Description attributes[:description]
21
+ xml.CampaignManager attributes[:campaign_manager]
22
+ xml.ProductId attributes[:product_id]
23
+ xml.ExternalUsers do
24
+ attributes[:external_users].each do |user_id|
25
+ xml.UserId user_id
26
+ end
27
+ end if attributes[:external_users]
28
+ xml.InternalQuickReport attributes[:internal_quick_report]
29
+ xml.ExternalQuickReport attributes[:external_quick_report]
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,59 @@
1
+ module Oass
2
+ class Client
3
+ attr_accessor :endpoint, :account, :username, :password
4
+
5
+ include Campaign
6
+ include Creative
7
+
8
+ def initialize(options = {})
9
+ options.reverse_merge! :endpoint => Oass.endpoint,
10
+ :account => Oass.account,
11
+ :username => Oass.username,
12
+ :password => Oass.password
13
+
14
+ options.each_pair do |key, value|
15
+ send "#{key}=", value
16
+ end
17
+ end
18
+
19
+ def request(method)
20
+ body = Nokogiri::XML::Builder.new(:encoding => "UTF-8") do |xml|
21
+ xml.AdXML do
22
+ xml.Request(:type => method) do
23
+ yield xml
24
+ end
25
+ end
26
+ end
27
+
28
+ response = Savon::Client.new(endpoint).request :n1, :oas_xml_request, :"xmlns:n1" => "http://api.oas.tfsm.com/" do
29
+ soap.body = {
30
+ "String_1" => account,
31
+ "String_2" => username,
32
+ "String_3" => password,
33
+ "String_4" => body.to_xml
34
+ }
35
+ end
36
+
37
+ parse(response)
38
+ end
39
+
40
+ protected
41
+
42
+ def parse(response)
43
+ response = Nokogiri::XML.parse(response.to_hash[:oas_xml_request_response][:result])
44
+ raise_errors(response)
45
+ response.css("AdXML > Response > *").first
46
+ end
47
+
48
+ def raise_errors(response)
49
+ return if (error = response.css("Exception")).empty?
50
+
51
+ case error.attribute("errorCode").value.to_i
52
+ when 545
53
+ raise Oass::NotFoundError.new error.first.content
54
+ else
55
+ raise Oass::OASError.new error.first.content
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,50 @@
1
+ module Oass
2
+ module Creative
3
+ def read_creative(campaign_id, id)
4
+ request "Creative" do |xml|
5
+ xml.Creative(:action => "read") do
6
+ xml.CampaignId campaign_id
7
+ xml.Id id
8
+ end
9
+ end
10
+ end
11
+
12
+ def create_creative(attributes)
13
+ request "Creative" do |xml|
14
+ xml.Creative(:action => "add") do
15
+ xml.CampaignId attributes[:campaign_id]
16
+ xml.Id attributes[:id]
17
+ xml.Name attributes[:name]
18
+ xml.Description attributes[:description]
19
+ xml.ClickUrl attributes[:click_url]
20
+ xml.Positions do
21
+ attributes[:positions].each do |position|
22
+ xml.Position position
23
+ end
24
+ end
25
+ xml.CreativeTypesId attributes[:creative_types_id]
26
+ xml.RedirectUrl attributes[:redirect_url]
27
+ xml.Display attributes[:display]
28
+ xml.Height attributes[:height]
29
+ xml.Width attributes[:width]
30
+ xml.TargetWindow attributes[:target_window]
31
+ xml.AltText attributes[:alt_text]
32
+ xml.DiscountImpressions attributes[:discount_impressions]
33
+ xml.StartDate attributes[:start_date]
34
+ xml.EndDate attributes[:end_date]
35
+ xml.Weight attributes[:weight]
36
+ xml.ExpireImmediately attributes[:expire_immediately]
37
+ xml.NoCache attributes[:no_cache]
38
+ xml.ExtraHTML attributes[:extra_html]
39
+ xml.ExtraText attributes[:extra_text]
40
+ xml.BrowserV do
41
+ attributes[:browser_versions].each do |version|
42
+ xml.Code version
43
+ end
44
+ end
45
+ xml.SequenceNo attributes[:sequence_number]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,4 @@
1
+ module Oass
2
+ class OASError < StandardError; end
3
+ class NotFoundError < OASError; end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Oass
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "oass/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "oass"
7
+ s.version = Oass::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Rodrigo Navarro"]
10
+ s.email = ["navarro@manapot.com.br"]
11
+ s.homepage = ""
12
+ s.summary = %q{Funny API to access OAS hellish soap interface}
13
+ s.description = %q{Help you to communicate with the corporate advertisers world!}
14
+
15
+ s.rubyforge_project = "oass"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "savon", "~> 0.9.2"
23
+ s.add_dependency "nokogiri", "~> 1.4.4"
24
+ s.add_dependency "activesupport", "~> 3.0.0"
25
+ end
@@ -0,0 +1,240 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://training7.247realmedia.com:443//oasapi/OaxApi?wsdl
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ etag:
14
+ - "\"44e617-674-48c8d0448cd40\""
15
+ p3p:
16
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
17
+ last-modified:
18
+ - Thu, 29 Jul 2010 20:59:57 GMT
19
+ content-type:
20
+ - text/xml
21
+ server:
22
+ - Apache/2.2.3 (Red Hat)
23
+ date:
24
+ - Wed, 25 May 2011 22:50:14 GMT
25
+ content-length:
26
+ - "1652"
27
+ accept-ranges:
28
+ - bytes
29
+ body: |
30
+ <?xml version="1.0" encoding="UTF-8"?>
31
+ <definitions name="OaxApiService" targetNamespace="http://api.oas.tfsm.com/" xmlns:tns="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
32
+ <types>
33
+ </types>
34
+ <message name="OaxApi_OasXmlRequestResponse">
35
+ <part name="result" type="xsd:string">
36
+ </part>
37
+ </message>
38
+ <message name="OaxApi_OasXmlRequest">
39
+ <part name="String_1" type="xsd:string">
40
+
41
+ </part>
42
+ <part name="String_2" type="xsd:string">
43
+ </part>
44
+ <part name="String_3" type="xsd:string">
45
+ </part>
46
+ <part name="String_4" type="xsd:string">
47
+ </part>
48
+ </message>
49
+ <portType name="OaxApi">
50
+
51
+ <operation name="OasXmlRequest" parameterOrder="String_1 String_2 String_3 String_4">
52
+ <input message="tns:OaxApi_OasXmlRequest">
53
+ </input>
54
+ <output message="tns:OaxApi_OasXmlRequestResponse">
55
+ </output>
56
+ </operation>
57
+ </portType>
58
+ <binding name="OaxApiBinding" type="tns:OaxApi">
59
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
60
+
61
+ <operation name="OasXmlRequest">
62
+ <soap:operation soapAction=""/>
63
+ <input>
64
+ <soap:body use="literal" namespace="http://api.oas.tfsm.com/"/>
65
+ </input>
66
+ <output>
67
+ <soap:body use="literal" namespace="http://api.oas.tfsm.com/"/>
68
+ </output>
69
+ </operation>
70
+
71
+ </binding>
72
+ <service name="OaxApiService">
73
+ <port name="OaxApiPort" binding="tns:OaxApiBinding">
74
+ <soap:address location="https://training7.247realmedia.com:443/oasapi/OaxApi"/>
75
+ </port>
76
+ </service>
77
+ </definitions>
78
+
79
+ http_version: "1.1"
80
+ - !ruby/struct:VCR::HTTPInteraction
81
+ request: !ruby/struct:VCR::Request
82
+ method: :post
83
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
84
+ body: |-
85
+ <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:n1="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:OasXmlRequest xmlns:n1="http://api.oas.tfsm.com/"><String_1>Abril</String_1><String_2>dev_abril</String_2><String_3>d3v@p1SgpD</String_3><String_4>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
86
+ &lt;AdXML&gt;
87
+ &lt;Request type=&quot;Campaign&quot;&gt;
88
+ &lt;Campaign action=&quot;read&quot;&gt;
89
+ &lt;Overview&gt;
90
+ &lt;Id&gt;abx_oferta3&lt;/Id&gt;
91
+ &lt;/Overview&gt;
92
+ &lt;/Campaign&gt;
93
+ &lt;/Request&gt;
94
+ &lt;/AdXML&gt;
95
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
96
+ headers:
97
+ content-type:
98
+ - text/xml;charset=UTF-8
99
+ soapaction:
100
+ - "\"OasXmlRequest\""
101
+ response: !ruby/struct:VCR::Response
102
+ status: !ruby/struct:VCR::ResponseStatus
103
+ code: 200
104
+ message: OK
105
+ headers:
106
+ x-powered-by:
107
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
108
+ p3p:
109
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
110
+ content-type:
111
+ - text/xml;charset=UTF-8
112
+ via:
113
+ - 1.1 training7.247realmedia.com
114
+ server:
115
+ - Apache-Coyote/1.1
116
+ date:
117
+ - Wed, 25 May 2011 22:50:15 GMT
118
+ transfer-encoding:
119
+ - chunked
120
+ body: |-
121
+ <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:OasXmlRequestResponse xmlns:ns1="http://api.oas.tfsm.com/"><result>&lt;?xml version='1.0'?>
122
+ &lt;AdXML>
123
+
124
+ &lt;Response>
125
+ &lt;Campaign>
126
+ &lt;Overview>
127
+ &lt;Id>abx_oferta3&lt;/Id>
128
+ &lt;AdvertiserId>abx_anunciante&lt;/AdvertiserId>
129
+ &lt;Name>abx_oferta2&lt;/Name>
130
+ &lt;AgencyId>vitrine&lt;/AgencyId>
131
+ &lt;Description/>
132
+ &lt;ProductId>vitrine&lt;/ProductId>
133
+ &lt;Status>L&lt;/Status>
134
+ &lt;CampaignGroups>
135
+ &lt;CampaignGroupId>abx_anunciante&lt;/CampaignGroupId>
136
+ &lt;/CampaignGroups>
137
+ &lt;CompetitiveCategories/>
138
+ &lt;ExternalUsers/>
139
+ &lt;InternalQuickReport>to-date&lt;/InternalQuickReport>
140
+ &lt;ExternalQuickReport>short&lt;/ExternalQuickReport>
141
+ &lt;WhoCreated>vitrine_api&lt;/WhoCreated>
142
+ &lt;WhenCreated>2011-04-11 16:15:32&lt;/WhenCreated>
143
+ &lt;WhoModified>interface_abril&lt;/WhoModified>
144
+ &lt;WhenModified>2011-05-25 11:54:39&lt;/WhenModified>
145
+ &lt;/Overview>
146
+ &lt;Schedule>
147
+ &lt;Impressions>0&lt;/Impressions>
148
+ &lt;Clicks>0&lt;/Clicks>
149
+ &lt;Uniques>0&lt;/Uniques>
150
+ &lt;Weight>0&lt;/Weight>
151
+ &lt;PriorityLevel>5&lt;/PriorityLevel>
152
+ &lt;Completion>S&lt;/Completion>
153
+ &lt;StartDate>2011-04-11&lt;/StartDate>
154
+ &lt;StartTime>00:00&lt;/StartTime>
155
+ &lt;EndDate>&lt;/EndDate>
156
+ &lt;EndTime>&lt;/EndTime>
157
+ &lt;Reach>O&lt;/Reach>
158
+ &lt;DailyImp>0&lt;/DailyImp>
159
+ &lt;DailyGoals/>
160
+ &lt;DailyClicks>0&lt;/DailyClicks>
161
+ &lt;DailyUniq>0&lt;/DailyUniq>
162
+ &lt;SmoothOrAsap>S&lt;/SmoothOrAsap>
163
+ &lt;ImpOverrun>0&lt;/ImpOverrun>
164
+ &lt;CompanionPositions/>
165
+ &lt;StrictCompanions>N&lt;/StrictCompanions>
166
+ &lt;PrimaryFrequency>
167
+ &lt;ImpPerVisitor>0&lt;/ImpPerVisitor>
168
+ &lt;ClickPerVisitor>0&lt;/ClickPerVisitor>
169
+ &lt;FreqScope>0&lt;/FreqScope>
170
+ &lt;/PrimaryFrequency>
171
+ &lt;SecondaryFrequency>
172
+ &lt;ImpPerVisitor>0&lt;/ImpPerVisitor>
173
+ &lt;FreqScope>0&lt;/FreqScope>
174
+ &lt;/SecondaryFrequency>
175
+ &lt;HourOfDay/>
176
+ &lt;DayOfWeek/>
177
+ &lt;UserTimeZone>N&lt;/UserTimeZone>
178
+ &lt;Sections/>
179
+ &lt;CampaignPauses/>
180
+ &lt;/Schedule>
181
+ &lt;Pages/>
182
+ &lt;Target>
183
+ &lt;ExcludeTargets>N&lt;/ExcludeTargets>
184
+ &lt;TopLevelDomain/>
185
+ &lt;Domain>&lt;/Domain>
186
+ &lt;Bandwidth/>
187
+ &lt;Continent/>
188
+ &lt;Country/>
189
+ &lt;State/>
190
+ &lt;AreaCode/>
191
+ &lt;Msa/>
192
+ &lt;Dma/>
193
+ &lt;City/>
194
+ &lt;Zones/>
195
+ &lt;Zip/>
196
+ &lt;ClaritasSegments/>
197
+ &lt;Omniture/>
198
+ &lt;Os/>
199
+ &lt;Browser/>
200
+ &lt;BrowserV/>
201
+ &lt;SearchType>A&lt;/SearchType>
202
+ &lt;SearchTerm>&lt;/SearchTerm>
203
+ &lt;Cookie/>
204
+ &lt;AgeFrom>&lt;/AgeFrom>
205
+ &lt;AgeTo>&lt;/AgeTo>
206
+ &lt;Gender>
207
+ &lt;Code>E&lt;/Code>
208
+ &lt;/Gender>
209
+ &lt;IncomeFrom>&lt;/IncomeFrom>
210
+ &lt;IncomeTo>&lt;/IncomeTo>
211
+ &lt;SubscriberCode>&lt;/SubscriberCode>
212
+ &lt;PreferenceFlags>&lt;/PreferenceFlags>
213
+ &lt;Cluster/>
214
+ &lt;/Target>
215
+ &lt;Exclude>
216
+ &lt;Sites/>
217
+ &lt;Pages/>
218
+ &lt;/Exclude>
219
+ &lt;Billing>
220
+ &lt;ContractedRevenue>&lt;/ContractedRevenue>
221
+ &lt;BillOffContracted>N&lt;/BillOffContracted>
222
+ &lt;Cpm>0.0000&lt;/Cpm>
223
+ &lt;Cpc>0.0000&lt;/Cpc>
224
+ &lt;Cpa>&lt;/Cpa>
225
+ &lt;FlatRate>&lt;/FlatRate>
226
+ &lt;Tax>&lt;/Tax>
227
+ &lt;AgencyCommission>0.00&lt;/AgencyCommission>
228
+ &lt;PaymentMethod>C&lt;/PaymentMethod>
229
+ &lt;PurchaseOrder/>
230
+ &lt;SalesRepresentative/>
231
+ &lt;CommissionPercent>0.0000&lt;/CommissionPercent>
232
+ &lt;Notes/>
233
+ &lt;IsYieldManaged>N&lt;/IsYieldManaged>
234
+ &lt;BillTo>G&lt;/BillTo>
235
+ &lt;Currency/>
236
+ &lt;/Billing>
237
+ &lt;/Campaign>
238
+ &lt;/Response>
239
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
240
+ http_version: "1.1"
@@ -0,0 +1,160 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://training7.247realmedia.com:443//oasapi/OaxApi?wsdl
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ etag:
14
+ - "\"44e617-674-48c8d0448cd40\""
15
+ p3p:
16
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
17
+ last-modified:
18
+ - Thu, 29 Jul 2010 20:59:57 GMT
19
+ content-type:
20
+ - text/xml
21
+ server:
22
+ - Apache/2.2.3 (Red Hat)
23
+ date:
24
+ - Wed, 25 May 2011 22:50:16 GMT
25
+ content-length:
26
+ - "1652"
27
+ accept-ranges:
28
+ - bytes
29
+ body: |
30
+ <?xml version="1.0" encoding="UTF-8"?>
31
+ <definitions name="OaxApiService" targetNamespace="http://api.oas.tfsm.com/" xmlns:tns="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
32
+ <types>
33
+ </types>
34
+ <message name="OaxApi_OasXmlRequestResponse">
35
+ <part name="result" type="xsd:string">
36
+ </part>
37
+ </message>
38
+ <message name="OaxApi_OasXmlRequest">
39
+ <part name="String_1" type="xsd:string">
40
+
41
+ </part>
42
+ <part name="String_2" type="xsd:string">
43
+ </part>
44
+ <part name="String_3" type="xsd:string">
45
+ </part>
46
+ <part name="String_4" type="xsd:string">
47
+ </part>
48
+ </message>
49
+ <portType name="OaxApi">
50
+
51
+ <operation name="OasXmlRequest" parameterOrder="String_1 String_2 String_3 String_4">
52
+ <input message="tns:OaxApi_OasXmlRequest">
53
+ </input>
54
+ <output message="tns:OaxApi_OasXmlRequestResponse">
55
+ </output>
56
+ </operation>
57
+ </portType>
58
+ <binding name="OaxApiBinding" type="tns:OaxApi">
59
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
60
+
61
+ <operation name="OasXmlRequest">
62
+ <soap:operation soapAction=""/>
63
+ <input>
64
+ <soap:body use="literal" namespace="http://api.oas.tfsm.com/"/>
65
+ </input>
66
+ <output>
67
+ <soap:body use="literal" namespace="http://api.oas.tfsm.com/"/>
68
+ </output>
69
+ </operation>
70
+
71
+ </binding>
72
+ <service name="OaxApiService">
73
+ <port name="OaxApiPort" binding="tns:OaxApiBinding">
74
+ <soap:address location="https://training7.247realmedia.com:443/oasapi/OaxApi"/>
75
+ </port>
76
+ </service>
77
+ </definitions>
78
+
79
+ http_version: "1.1"
80
+ - !ruby/struct:VCR::HTTPInteraction
81
+ request: !ruby/struct:VCR::Request
82
+ method: :post
83
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
84
+ body: |-
85
+ <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:n1="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:OasXmlRequest xmlns:n1="http://api.oas.tfsm.com/"><String_1>Abril</String_1><String_2>dev_abril</String_2><String_3>d3v@p1SgpD</String_3><String_4>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
86
+ &lt;AdXML&gt;
87
+ &lt;Request type=&quot;Creative&quot;&gt;
88
+ &lt;Creative action=&quot;read&quot;&gt;
89
+ &lt;CampaignId&gt;abx_oferta3&lt;/CampaignId&gt;
90
+ &lt;Id&gt;creatiewut&lt;/Id&gt;
91
+ &lt;/Creative&gt;
92
+ &lt;/Request&gt;
93
+ &lt;/AdXML&gt;
94
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
95
+ headers:
96
+ content-type:
97
+ - text/xml;charset=UTF-8
98
+ soapaction:
99
+ - "\"OasXmlRequest\""
100
+ response: !ruby/struct:VCR::Response
101
+ status: !ruby/struct:VCR::ResponseStatus
102
+ code: 200
103
+ message: OK
104
+ headers:
105
+ x-powered-by:
106
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
107
+ p3p:
108
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
109
+ content-type:
110
+ - text/xml;charset=UTF-8
111
+ via:
112
+ - 1.1 training7.247realmedia.com
113
+ server:
114
+ - Apache-Coyote/1.1
115
+ date:
116
+ - Wed, 25 May 2011 22:50:17 GMT
117
+ transfer-encoding:
118
+ - chunked
119
+ body: |-
120
+ <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:OasXmlRequestResponse xmlns:ns1="http://api.oas.tfsm.com/"><result>&lt;?xml version='1.0'?>
121
+ &lt;AdXML>
122
+
123
+ &lt;Response>
124
+ &lt;Creative>
125
+ &lt;CampaignId>abx_oferta3&lt;/CampaignId>
126
+ &lt;Id>creatiewut&lt;/Id>
127
+ &lt;Name>creatiewut&lt;/Name>
128
+ &lt;Description/>
129
+ &lt;ClickUrl>test&lt;/ClickUrl>
130
+ &lt;Positions>
131
+ &lt;Position>x05&lt;/Position>
132
+ &lt;/Positions>
133
+ &lt;CreativeTypesId>unknown_type&lt;/CreativeTypesId>
134
+ &lt;Display>Y&lt;/Display>
135
+ &lt;Height/>
136
+ &lt;Width/>
137
+ &lt;TargetWindow/>
138
+ &lt;AltText/>
139
+ &lt;DiscountImpressions>N&lt;/DiscountImpressions>
140
+ &lt;StartDate/>
141
+ &lt;StartTime>&lt;/StartTime>
142
+ &lt;EndDate/>
143
+ &lt;EndTime>&lt;/EndTime>
144
+ &lt;Weight>10&lt;/Weight>
145
+ &lt;ExpireImmediately>N&lt;/ExpireImmediately>
146
+ &lt;NoCache>N&lt;/NoCache>
147
+ &lt;ExtraHTML/>
148
+ &lt;ExtraText/>
149
+ &lt;RichMediaCpm>0.0&lt;/RichMediaCpm>
150
+ &lt;BrowserV/>
151
+ &lt;SequenceNo/>
152
+ &lt;CountOnDownload>N&lt;/CountOnDownload>
153
+ &lt;WhoCreated>interface_abril&lt;/WhoCreated>
154
+ &lt;WhenCreated>2011-05-25 11:54:39&lt;/WhenCreated>
155
+ &lt;WhoModified>&lt;/WhoModified>
156
+ &lt;WhenModified>&lt;/WhenModified>
157
+ &lt;/Creative>
158
+ &lt;/Response>
159
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
160
+ http_version: "1.1"
@@ -0,0 +1,291 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://training7.247realmedia.com:443//oasapi/OaxApi?wsdl
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ etag:
14
+ - "\"44e617-674-48c8d0448cd40\""
15
+ last-modified:
16
+ - Thu, 29 Jul 2010 20:59:57 GMT
17
+ p3p:
18
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
19
+ content-type:
20
+ - text/xml
21
+ date:
22
+ - Wed, 25 May 2011 22:50:11 GMT
23
+ server:
24
+ - Apache/2.2.3 (Red Hat)
25
+ content-length:
26
+ - "1652"
27
+ accept-ranges:
28
+ - bytes
29
+ body: |
30
+ <?xml version="1.0" encoding="UTF-8"?>
31
+ <definitions name="OaxApiService" targetNamespace="http://api.oas.tfsm.com/" xmlns:tns="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
32
+ <types>
33
+ </types>
34
+ <message name="OaxApi_OasXmlRequestResponse">
35
+ <part name="result" type="xsd:string">
36
+ </part>
37
+ </message>
38
+ <message name="OaxApi_OasXmlRequest">
39
+ <part name="String_1" type="xsd:string">
40
+
41
+ </part>
42
+ <part name="String_2" type="xsd:string">
43
+ </part>
44
+ <part name="String_3" type="xsd:string">
45
+ </part>
46
+ <part name="String_4" type="xsd:string">
47
+ </part>
48
+ </message>
49
+ <portType name="OaxApi">
50
+
51
+ <operation name="OasXmlRequest" parameterOrder="String_1 String_2 String_3 String_4">
52
+ <input message="tns:OaxApi_OasXmlRequest">
53
+ </input>
54
+ <output message="tns:OaxApi_OasXmlRequestResponse">
55
+ </output>
56
+ </operation>
57
+ </portType>
58
+ <binding name="OaxApiBinding" type="tns:OaxApi">
59
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
60
+
61
+ <operation name="OasXmlRequest">
62
+ <soap:operation soapAction=""/>
63
+ <input>
64
+ <soap:body use="literal" namespace="http://api.oas.tfsm.com/"/>
65
+ </input>
66
+ <output>
67
+ <soap:body use="literal" namespace="http://api.oas.tfsm.com/"/>
68
+ </output>
69
+ </operation>
70
+
71
+ </binding>
72
+ <service name="OaxApiService">
73
+ <port name="OaxApiPort" binding="tns:OaxApiBinding">
74
+ <soap:address location="https://training7.247realmedia.com:443/oasapi/OaxApi"/>
75
+ </port>
76
+ </service>
77
+ </definitions>
78
+
79
+ http_version: "1.1"
80
+ - !ruby/struct:VCR::HTTPInteraction
81
+ request: !ruby/struct:VCR::Request
82
+ method: :post
83
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
84
+ body: |-
85
+ <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:n1="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:OasXmlRequest xmlns:n1="http://api.oas.tfsm.com/"><String_1>Abril</String_1><String_2>dev_abril</String_2><String_3>d3v@p1SgpD</String_3><String_4>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
86
+ &lt;AdXML&gt;
87
+ &lt;Request type=&quot;Campaign&quot;&gt;
88
+ &lt;Campaign action=&quot;read&quot;&gt;
89
+ &lt;Overview&gt;
90
+ &lt;Id&gt;abx_oferta3&lt;/Id&gt;
91
+ &lt;/Overview&gt;
92
+ &lt;/Campaign&gt;
93
+ &lt;/Request&gt;
94
+ &lt;/AdXML&gt;
95
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
96
+ headers:
97
+ soapaction:
98
+ - "\"OasXmlRequest\""
99
+ content-type:
100
+ - text/xml;charset=UTF-8
101
+ response: !ruby/struct:VCR::Response
102
+ status: !ruby/struct:VCR::ResponseStatus
103
+ code: 200
104
+ message: OK
105
+ headers:
106
+ x-powered-by:
107
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
108
+ p3p:
109
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
110
+ via:
111
+ - 1.1 training7.247realmedia.com
112
+ content-type:
113
+ - text/xml;charset=UTF-8
114
+ date:
115
+ - Wed, 25 May 2011 22:50:12 GMT
116
+ server:
117
+ - Apache-Coyote/1.1
118
+ transfer-encoding:
119
+ - chunked
120
+ body: |-
121
+ <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:OasXmlRequestResponse xmlns:ns1="http://api.oas.tfsm.com/"><result>&lt;?xml version='1.0'?>
122
+ &lt;AdXML>
123
+
124
+ &lt;Response>
125
+ &lt;Campaign>
126
+ &lt;Overview>
127
+ &lt;Id>abx_oferta3&lt;/Id>
128
+ &lt;AdvertiserId>abx_anunciante&lt;/AdvertiserId>
129
+ &lt;Name>abx_oferta2&lt;/Name>
130
+ &lt;AgencyId>vitrine&lt;/AgencyId>
131
+ &lt;Description/>
132
+ &lt;ProductId>vitrine&lt;/ProductId>
133
+ &lt;Status>L&lt;/Status>
134
+ &lt;CampaignGroups>
135
+ &lt;CampaignGroupId>abx_anunciante&lt;/CampaignGroupId>
136
+ &lt;/CampaignGroups>
137
+ &lt;CompetitiveCategories/>
138
+ &lt;ExternalUsers/>
139
+ &lt;InternalQuickReport>to-date&lt;/InternalQuickReport>
140
+ &lt;ExternalQuickReport>short&lt;/ExternalQuickReport>
141
+ &lt;WhoCreated>vitrine_api&lt;/WhoCreated>
142
+ &lt;WhenCreated>2011-04-11 16:15:32&lt;/WhenCreated>
143
+ &lt;WhoModified>interface_abril&lt;/WhoModified>
144
+ &lt;WhenModified>2011-05-25 11:54:39&lt;/WhenModified>
145
+ &lt;/Overview>
146
+ &lt;Schedule>
147
+ &lt;Impressions>0&lt;/Impressions>
148
+ &lt;Clicks>0&lt;/Clicks>
149
+ &lt;Uniques>0&lt;/Uniques>
150
+ &lt;Weight>0&lt;/Weight>
151
+ &lt;PriorityLevel>5&lt;/PriorityLevel>
152
+ &lt;Completion>S&lt;/Completion>
153
+ &lt;StartDate>2011-04-11&lt;/StartDate>
154
+ &lt;StartTime>00:00&lt;/StartTime>
155
+ &lt;EndDate>&lt;/EndDate>
156
+ &lt;EndTime>&lt;/EndTime>
157
+ &lt;Reach>O&lt;/Reach>
158
+ &lt;DailyImp>0&lt;/DailyImp>
159
+ &lt;DailyGoals/>
160
+ &lt;DailyClicks>0&lt;/DailyClicks>
161
+ &lt;DailyUniq>0&lt;/DailyUniq>
162
+ &lt;SmoothOrAsap>S&lt;/SmoothOrAsap>
163
+ &lt;ImpOverrun>0&lt;/ImpOverrun>
164
+ &lt;CompanionPositions/>
165
+ &lt;StrictCompanions>N&lt;/StrictCompanions>
166
+ &lt;PrimaryFrequency>
167
+ &lt;ImpPerVisitor>0&lt;/ImpPerVisitor>
168
+ &lt;ClickPerVisitor>0&lt;/ClickPerVisitor>
169
+ &lt;FreqScope>0&lt;/FreqScope>
170
+ &lt;/PrimaryFrequency>
171
+ &lt;SecondaryFrequency>
172
+ &lt;ImpPerVisitor>0&lt;/ImpPerVisitor>
173
+ &lt;FreqScope>0&lt;/FreqScope>
174
+ &lt;/SecondaryFrequency>
175
+ &lt;HourOfDay/>
176
+ &lt;DayOfWeek/>
177
+ &lt;UserTimeZone>N&lt;/UserTimeZone>
178
+ &lt;Sections/>
179
+ &lt;CampaignPauses/>
180
+ &lt;/Schedule>
181
+ &lt;Pages/>
182
+ &lt;Target>
183
+ &lt;ExcludeTargets>N&lt;/ExcludeTargets>
184
+ &lt;TopLevelDomain/>
185
+ &lt;Domain>&lt;/Domain>
186
+ &lt;Bandwidth/>
187
+ &lt;Continent/>
188
+ &lt;Country/>
189
+ &lt;State/>
190
+ &lt;AreaCode/>
191
+ &lt;Msa/>
192
+ &lt;Dma/>
193
+ &lt;City/>
194
+ &lt;Zones/>
195
+ &lt;Zip/>
196
+ &lt;ClaritasSegments/>
197
+ &lt;Omniture/>
198
+ &lt;Os/>
199
+ &lt;Browser/>
200
+ &lt;BrowserV/>
201
+ &lt;SearchType>A&lt;/SearchType>
202
+ &lt;SearchTerm>&lt;/SearchTerm>
203
+ &lt;Cookie/>
204
+ &lt;AgeFrom>&lt;/AgeFrom>
205
+ &lt;AgeTo>&lt;/AgeTo>
206
+ &lt;Gender>
207
+ &lt;Code>E&lt;/Code>
208
+ &lt;/Gender>
209
+ &lt;IncomeFrom>&lt;/IncomeFrom>
210
+ &lt;IncomeTo>&lt;/IncomeTo>
211
+ &lt;SubscriberCode>&lt;/SubscriberCode>
212
+ &lt;PreferenceFlags>&lt;/PreferenceFlags>
213
+ &lt;Cluster/>
214
+ &lt;/Target>
215
+ &lt;Exclude>
216
+ &lt;Sites/>
217
+ &lt;Pages/>
218
+ &lt;/Exclude>
219
+ &lt;Billing>
220
+ &lt;ContractedRevenue>&lt;/ContractedRevenue>
221
+ &lt;BillOffContracted>N&lt;/BillOffContracted>
222
+ &lt;Cpm>0.0000&lt;/Cpm>
223
+ &lt;Cpc>0.0000&lt;/Cpc>
224
+ &lt;Cpa>&lt;/Cpa>
225
+ &lt;FlatRate>&lt;/FlatRate>
226
+ &lt;Tax>&lt;/Tax>
227
+ &lt;AgencyCommission>0.00&lt;/AgencyCommission>
228
+ &lt;PaymentMethod>C&lt;/PaymentMethod>
229
+ &lt;PurchaseOrder/>
230
+ &lt;SalesRepresentative/>
231
+ &lt;CommissionPercent>0.0000&lt;/CommissionPercent>
232
+ &lt;Notes/>
233
+ &lt;IsYieldManaged>N&lt;/IsYieldManaged>
234
+ &lt;BillTo>G&lt;/BillTo>
235
+ &lt;Currency/>
236
+ &lt;/Billing>
237
+ &lt;/Campaign>
238
+ &lt;/Response>
239
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
240
+ http_version: "1.1"
241
+ - !ruby/struct:VCR::HTTPInteraction
242
+ request: !ruby/struct:VCR::Request
243
+ method: :post
244
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
245
+ body: |-
246
+ <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:n1="http://api.oas.tfsm.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:OasXmlRequest xmlns:n1="http://api.oas.tfsm.com/"><String_1>Abril</String_1><String_2>dev_abril</String_2><String_3>d3v@p1SgpD</String_3><String_4>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
247
+ &lt;AdXML&gt;
248
+ &lt;Request type=&quot;Campaign&quot;&gt;
249
+ &lt;Campaign action=&quot;read&quot;&gt;
250
+ &lt;Overview&gt;
251
+ &lt;Id&gt;invalid_id_lol&lt;/Id&gt;
252
+ &lt;/Overview&gt;
253
+ &lt;/Campaign&gt;
254
+ &lt;/Request&gt;
255
+ &lt;/AdXML&gt;
256
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
257
+ headers:
258
+ content-type:
259
+ - text/xml;charset=UTF-8
260
+ soapaction:
261
+ - "\"OasXmlRequest\""
262
+ response: !ruby/struct:VCR::Response
263
+ status: !ruby/struct:VCR::ResponseStatus
264
+ code: 200
265
+ message: OK
266
+ headers:
267
+ x-powered-by:
268
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
269
+ p3p:
270
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
271
+ content-type:
272
+ - text/xml;charset=UTF-8
273
+ via:
274
+ - 1.1 training7.247realmedia.com
275
+ server:
276
+ - Apache-Coyote/1.1
277
+ date:
278
+ - Wed, 25 May 2011 22:50:13 GMT
279
+ transfer-encoding:
280
+ - chunked
281
+ body: |-
282
+ <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:OasXmlRequestResponse xmlns:ns1="http://api.oas.tfsm.com/"><result>&lt;?xml version='1.0'?>
283
+ &lt;AdXML>
284
+
285
+ &lt;Response>
286
+ &lt;Campaign>
287
+ &lt;Exception errorCode='545'>Invalid CampaignId.&lt;/Exception>
288
+ &lt;/Campaign>
289
+ &lt;/Response>
290
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
291
+ http_version: "1.1"
@@ -0,0 +1,161 @@
1
+ require "spec_helper"
2
+
3
+ describe Oass::Client do
4
+ context "configuration" do
5
+ [:endpoint, :account, :username, :password].each do |setting|
6
+ context "on initialization" do
7
+ subject { Oass::Client.new setting => "WUT" }
8
+ its(setting) { should == "WUT" }
9
+ end
10
+
11
+ context "after initialization" do
12
+ subject { Oass::Client.new }
13
+ before { subject.send("#{setting}=", "WUT") }
14
+ its(setting) { should == "WUT" }
15
+ end
16
+ end
17
+ end
18
+
19
+ describe "#request" do
20
+ use_vcr_cassette :record => :new_episodes, :match_requests_on => [:uri, :method, :body]
21
+
22
+ let(:client) { Oass::Client.new }
23
+
24
+ context "successfully" do
25
+ subject do
26
+ client.request "Campaign" do |xml|
27
+ xml.Campaign(:action => "read") do
28
+ xml.Overview { xml.Id "abx_oferta3" }
29
+ end
30
+ end
31
+ end
32
+
33
+ it "finds the right campaign" do
34
+ subject.css("Id").first.content.should == "abx_oferta3"
35
+ end
36
+ end
37
+
38
+ context "unsuccessfully" do
39
+ it "raises a OASError" do
40
+ expect {
41
+ client.request "Campaign" do |xml|
42
+ xml.Campaign(:action => "read") do
43
+ xml.Overview { xml.Id "invalid_id_lol" }
44
+ end
45
+ end
46
+ }.to raise_error(Oass::OASError)
47
+ end
48
+ end
49
+ end
50
+
51
+ describe "#read_campaign" do
52
+ use_vcr_cassette :record => :new_episodes, :match_requests_on => [:uri, :method, :body]
53
+
54
+ let(:client) { Oass::Client.new }
55
+
56
+ context "with a valid id" do
57
+ subject { client.read_campaign("abx_oferta3") }
58
+
59
+ it "finds the right campaign" do
60
+ subject.css("Id").first.content.should == "abx_oferta3"
61
+ end
62
+ end
63
+
64
+ context "with an invalid id" do
65
+ it "raises a NotFoundError" do
66
+ expect { client.read_campaign("LOLWUT").to raise_error(Oass::NotFoundError) }
67
+ end
68
+ end
69
+ end
70
+
71
+ describe "#read_creative" do
72
+ use_vcr_cassette :record => :new_episodes, :match_requests_on => [:uri, :method, :body]
73
+
74
+ let(:client) { Oass::Client.new }
75
+
76
+ context "with a valid id" do
77
+ subject { client.read_creative("abx_oferta3", "creatiewut") }
78
+
79
+ it "finds the right creative" do
80
+ subject.css("Id").first.content.should == "creatiewut"
81
+ end
82
+ end
83
+
84
+ context "with an invalid id" do
85
+ it "raises a NotFoundError" do
86
+ expect { client.read_creative("abx_oferta3", "LOLWUT").to raise_error(Oass::NotFoundError) }
87
+ end
88
+ end
89
+
90
+ context "with an invalid campaign id" do
91
+ it "raises a NotFoundError" do
92
+ expect { client.read_creative("LOLWUT", "creatiewut").to raise_error(Oass::NotFoundError) }
93
+ end
94
+ end
95
+ end
96
+
97
+ describe "#create_campaign" do
98
+ use_vcr_cassette :record => :new_episodes, :match_requests_on => [:uri, :method, :body]
99
+
100
+ let(:client) { Oass::Client.new }
101
+
102
+ context "with the required attributes" do
103
+ let(:attributes) do
104
+ {
105
+ :id => "random_id_lolwut_wtf",
106
+ :name => "LOLWUT",
107
+ :advertiser_id => "bobo",
108
+ :agency_id => "unknown_agency",
109
+ :name => "LOLWUT",
110
+ :campaign_manager => "lol",
111
+ :product_id => "default-product",
112
+ }
113
+ end
114
+
115
+ subject { client.create_campaign attributes }
116
+
117
+ its(:content) { "Successfully added." }
118
+ end
119
+ end
120
+
121
+ describe "#create_criative" do
122
+ use_vcr_cassette :record => :new_episodes, :match_requests_on => [:uri, :method, :body]
123
+
124
+ let(:client) { Oass::Client.new }
125
+
126
+ context "with valid attributes" do
127
+ let(:attributes) do
128
+ {
129
+ :campaign_id => "random_id_lolwut",
130
+ :id => "I_am_so_creative_lol",
131
+ :name => "A nice name indeed",
132
+ :description => "Blabla",
133
+ :click_url => "http://lolwut.com",
134
+ :positions => %w(TopLeft BottomLeft),
135
+ :creative_types_id => "unknow_type",
136
+ :redirect_url => "http://lolwut.com",
137
+ :display => "Y",
138
+ :height => "30",
139
+ :width => "30",
140
+ :target_window => "targetwindow",
141
+ :alt_text => "Oh hai!",
142
+ :discount_impressions => "N",
143
+ :start_date => "1986-03-31",
144
+ :end_date => "2040-03-31",
145
+ :weight => "79",
146
+ :expire_immediately => "N",
147
+ :no_cache => "N",
148
+ :extra_html => "<b></b>",
149
+ :extra_text => "kthxbai",
150
+ :browser_versions => %w(explorer6 netscape7),
151
+ :sequence_number => "4"
152
+ }
153
+
154
+ end
155
+
156
+ subject { client.create_creative attributes }
157
+
158
+ its(:content) { "Successfully added." }
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,11 @@
1
+ require "spec_helper"
2
+
3
+ describe Oass do
4
+ describe ".configure" do
5
+ [:endpoint, :account, :username, :password].each do |setting|
6
+ it "allows configuration for #{setting}" do
7
+ expect { Oass.send("#{setting}=", "LOL") }.to change { Oass.send(setting) }.to("LOL")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'oass'
2
+ require 'vcr'
3
+
4
+ VCR.config do |config|
5
+ config.cassette_library_dir = File.join("spec/fixtures/vcr_cassettes")
6
+ config.stub_with :webmock
7
+ end
8
+
9
+ RSpec.configure do |config|
10
+ config.extend VCR::RSpec::Macros
11
+ end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oass
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Rodrigo Navarro
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-25 00:00:00 -03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: savon
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 63
30
+ segments:
31
+ - 0
32
+ - 9
33
+ - 2
34
+ version: 0.9.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: nokogiri
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 1
48
+ - 4
49
+ - 4
50
+ version: 1.4.4
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: activesupport
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 7
62
+ segments:
63
+ - 3
64
+ - 0
65
+ - 0
66
+ version: 3.0.0
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ description: Help you to communicate with the corporate advertisers world!
70
+ email:
71
+ - navarro@manapot.com.br
72
+ executables: []
73
+
74
+ extensions: []
75
+
76
+ extra_rdoc_files: []
77
+
78
+ files:
79
+ - .gitignore
80
+ - Gemfile
81
+ - README.md
82
+ - Rakefile
83
+ - lib/oass.rb
84
+ - lib/oass/campaign.rb
85
+ - lib/oass/client.rb
86
+ - lib/oass/creative.rb
87
+ - lib/oass/errors.rb
88
+ - lib/oass/version.rb
89
+ - oass.gemspec
90
+ - spec/fixtures/vcr_cassettes/Oass_Client/_read_campaign.yml
91
+ - spec/fixtures/vcr_cassettes/Oass_Client/_read_creative.yml
92
+ - spec/fixtures/vcr_cassettes/Oass_Client/_request.yml
93
+ - spec/oass/client_spec.rb
94
+ - spec/oass/configuration_spec.rb
95
+ - spec/spec_helper.rb
96
+ has_rdoc: true
97
+ homepage: ""
98
+ licenses: []
99
+
100
+ post_install_message:
101
+ rdoc_options: []
102
+
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ hash: 3
111
+ segments:
112
+ - 0
113
+ version: "0"
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ requirements: []
124
+
125
+ rubyforge_project: oass
126
+ rubygems_version: 1.5.0
127
+ signing_key:
128
+ specification_version: 3
129
+ summary: Funny API to access OAS hellish soap interface
130
+ test_files:
131
+ - spec/fixtures/vcr_cassettes/Oass_Client/_read_campaign.yml
132
+ - spec/fixtures/vcr_cassettes/Oass_Client/_read_creative.yml
133
+ - spec/fixtures/vcr_cassettes/Oass_Client/_request.yml
134
+ - spec/oass/client_spec.rb
135
+ - spec/oass/configuration_spec.rb
136
+ - spec/spec_helper.rb