oass 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,4 +19,15 @@ module Oass
19
19
  def self.configure
20
20
  yield self
21
21
  end
22
+
23
+ class << self
24
+
25
+ def method_missing(method, *args, &block)
26
+ client.send(method, *args, &block)
27
+ end
28
+
29
+ def client
30
+ @client ||= Client.new
31
+ end
32
+ end
22
33
  end
@@ -10,17 +10,28 @@ module Oass
10
10
  end
11
11
 
12
12
  def create_campaign(attributes)
13
+ create_or_update_campaign("add", attributes)
14
+ end
15
+
16
+ def update_campaign(attributes)
17
+ create_or_update_campaign("update", attributes)
18
+ end
19
+
20
+ private
21
+
22
+ def create_or_update_campaign(action, attributes)
13
23
  request "Campaign" do |xml|
14
- xml.Campaign(:action => "add") do
24
+ xml.Campaign(:action => action) do
15
25
  xml.Overview do
16
26
  # Yeah... the attributes must be in the right order =/
17
27
  xml.Id attributes[:id]
18
- xml.AdvertiserId attributes[:advertiser_id]
19
- xml.Name attributes[:name]
20
- xml.AgencyId attributes[:agency_id]
28
+ xml.AdvertiserId attributes[:advertiser_id] if attributes[:advertiser_id]
29
+ xml.Name attributes[:name] if attributes[:name]
30
+ xml.AgencyId attributes[:agency_id] if attributes[:agency_id]
21
31
  xml.Description attributes[:description] if attributes[:description]
22
32
  xml.CampaignManager attributes[:campaign_manager] if attributes[:campaign_manager]
23
33
  xml.ProductId attributes[:product_id]
34
+ xml.Status attributes[:status] if attributes[:status]
24
35
  xml.ExternalUsers do
25
36
  attributes[:external_users].each do |user_id|
26
37
  xml.UserId user_id
@@ -102,5 +113,6 @@ module Oass
102
113
  end
103
114
  end
104
115
  end
116
+
105
117
  end
106
118
  end
@@ -1,3 +1,3 @@
1
1
  module Oass
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -23,6 +23,61 @@
23
23
  &lt;/Request&gt;
24
24
  &lt;/AdXML&gt;
25
25
  </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
26
+ headers:
27
+ content-type:
28
+ - text/xml;charset=UTF-8
29
+ soapaction:
30
+ - "\"OasXmlRequest\""
31
+ response: !ruby/struct:VCR::Response
32
+ status: !ruby/struct:VCR::ResponseStatus
33
+ code: 200
34
+ message: OK
35
+ headers:
36
+ x-powered-by:
37
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
38
+ p3p:
39
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
40
+ content-type:
41
+ - text/xml;charset=UTF-8
42
+ via:
43
+ - 1.1 training7.247realmedia.com
44
+ server:
45
+ - Apache-Coyote/1.1
46
+ date:
47
+ - Thu, 26 May 2011 01:29:55 GMT
48
+ transfer-encoding:
49
+ - chunked
50
+ body: |-
51
+ <?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'?>
52
+ &lt;AdXML>
53
+
54
+ &lt;Response>
55
+ &lt;Campaign>
56
+ &lt;Exception errorCode='505'> is an invalid value for Id&lt;/Exception>
57
+ &lt;/Campaign>
58
+ &lt;/Response>
59
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
60
+ http_version: "1.1"
61
+ - !ruby/struct:VCR::HTTPInteraction
62
+ request: !ruby/struct:VCR::Request
63
+ method: :post
64
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
65
+ body: |-
66
+ <?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;
67
+ &lt;AdXML&gt;
68
+ &lt;Request type=&quot;Campaign&quot;&gt;
69
+ &lt;Campaign action=&quot;add&quot;&gt;
70
+ &lt;Overview&gt;
71
+ &lt;Id&gt;&lt;/Id&gt;
72
+ &lt;AdvertiserId&gt;&lt;/AdvertiserId&gt;
73
+ &lt;Name&gt;&lt;/Name&gt;
74
+ &lt;AgencyId&gt;&lt;/AgencyId&gt;
75
+ &lt;ProductId&gt;&lt;/ProductId&gt;
76
+ &lt;/Overview&gt;
77
+ &lt;/Campaign&gt;
78
+ &lt;/Request&gt;
79
+ &lt;/AdXML&gt;
80
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
26
81
  headers:
27
82
  soapaction:
28
83
  - "\"OasXmlRequest\""
@@ -42,7 +97,7 @@
42
97
  content-type:
43
98
  - text/xml;charset=UTF-8
44
99
  date:
45
- - Thu, 26 May 2011 01:29:55 GMT
100
+ - Fri, 27 May 2011 13:02:16 GMT
46
101
  server:
47
102
  - Apache-Coyote/1.1
48
103
  transfer-encoding:
@@ -69,9 +124,6 @@
69
124
  &lt;Campaign action=&quot;add&quot;&gt;
70
125
  &lt;Overview&gt;
71
126
  &lt;Id&gt;&lt;/Id&gt;
72
- &lt;AdvertiserId&gt;&lt;/AdvertiserId&gt;
73
- &lt;Name&gt;&lt;/Name&gt;
74
- &lt;AgencyId&gt;&lt;/AgencyId&gt;
75
127
  &lt;ProductId&gt;&lt;/ProductId&gt;
76
128
  &lt;/Overview&gt;
77
129
  &lt;/Campaign&gt;
@@ -99,7 +151,7 @@
99
151
  server:
100
152
  - Apache-Coyote/1.1
101
153
  date:
102
- - Fri, 27 May 2011 13:02:16 GMT
154
+ - Wed, 01 Jun 2011 19:20:51 GMT
103
155
  transfer-encoding:
104
156
  - chunked
105
157
  body: |-
@@ -2431,6 +2431,161 @@
2431
2431
  <?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'?>
2432
2432
  &lt;AdXML>
2433
2433
 
2434
+ &lt;Response>
2435
+ &lt;Campaign>Successfully added.&lt;/Campaign>
2436
+ &lt;/Response>
2437
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
2438
+ http_version: "1.1"
2439
+ - !ruby/struct:VCR::HTTPInteraction
2440
+ request: !ruby/struct:VCR::Request
2441
+ method: :post
2442
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
2443
+ body: |-
2444
+ <?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;
2445
+ &lt;AdXML&gt;
2446
+ &lt;Request type=&quot;Campaign&quot;&gt;
2447
+ &lt;Campaign action=&quot;add&quot;&gt;
2448
+ &lt;Overview&gt;
2449
+ &lt;Id&gt;jdocapvxtklqfnbrzhgsyieumw&lt;/Id&gt;
2450
+ &lt;AdvertiserId&gt;bobo&lt;/AdvertiserId&gt;
2451
+ &lt;Name&gt;LOLWUT&lt;/Name&gt;
2452
+ &lt;AgencyId&gt;unknown_agency&lt;/AgencyId&gt;
2453
+ &lt;ProductId&gt;default-product&lt;/ProductId&gt;
2454
+ &lt;/Overview&gt;
2455
+ &lt;Schedule&gt;
2456
+ &lt;Impressions&gt;999&lt;/Impressions&gt;
2457
+ &lt;Clicks&gt;0&lt;/Clicks&gt;
2458
+ &lt;PriorityLevel&gt;1&lt;/PriorityLevel&gt;
2459
+ &lt;Completion&gt;S&lt;/Completion&gt;
2460
+ &lt;Reach&gt;O&lt;/Reach&gt;
2461
+ &lt;SmoothOrAsap&gt;S&lt;/SmoothOrAsap&gt;
2462
+ &lt;/Schedule&gt;
2463
+ &lt;/Campaign&gt;
2464
+ &lt;/Request&gt;
2465
+ &lt;/AdXML&gt;
2466
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
2467
+ headers:
2468
+ soapaction:
2469
+ - "\"OasXmlRequest\""
2470
+ content-type:
2471
+ - text/xml;charset=UTF-8
2472
+ response: !ruby/struct:VCR::Response
2473
+ status: !ruby/struct:VCR::ResponseStatus
2474
+ code: 200
2475
+ message: OK
2476
+ headers:
2477
+ x-powered-by:
2478
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
2479
+ p3p:
2480
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
2481
+ via:
2482
+ - 1.1 training7.247realmedia.com
2483
+ content-type:
2484
+ - text/xml;charset=UTF-8
2485
+ date:
2486
+ - Wed, 01 Jun 2011 19:20:47 GMT
2487
+ server:
2488
+ - Apache-Coyote/1.1
2489
+ transfer-encoding:
2490
+ - chunked
2491
+ body: |-
2492
+ <?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'?>
2493
+ &lt;AdXML>
2494
+
2495
+ &lt;Response>
2496
+ &lt;Campaign>Successfully added.&lt;/Campaign>
2497
+ &lt;/Response>
2498
+ &lt;/AdXML></result></ns1:OasXmlRequestResponse></soapenv:Body></soapenv:Envelope>
2499
+ http_version: "1.1"
2500
+ - !ruby/struct:VCR::HTTPInteraction
2501
+ request: !ruby/struct:VCR::Request
2502
+ method: :post
2503
+ uri: https://training7.247realmedia.com:443/oasapi/OaxApi
2504
+ body: |-
2505
+ <?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;
2506
+ &lt;AdXML&gt;
2507
+ &lt;Request type=&quot;Campaign&quot;&gt;
2508
+ &lt;Campaign action=&quot;add&quot;&gt;
2509
+ &lt;Overview&gt;
2510
+ &lt;Id&gt;gdyfonbvijlxcpsweahtuqkmrz&lt;/Id&gt;
2511
+ &lt;AdvertiserId&gt;bobo&lt;/AdvertiserId&gt;
2512
+ &lt;Name&gt;LOLWUT&lt;/Name&gt;
2513
+ &lt;AgencyId&gt;unknown_agency&lt;/AgencyId&gt;
2514
+ &lt;Description&gt;lolwut&lt;/Description&gt;
2515
+ &lt;CampaignManager&gt;lol&lt;/CampaignManager&gt;
2516
+ &lt;ProductId&gt;default-product&lt;/ProductId&gt;
2517
+ &lt;InternalQuickReport&gt;short&lt;/InternalQuickReport&gt;
2518
+ &lt;ExternalQuickReport&gt;short&lt;/ExternalQuickReport&gt;
2519
+ &lt;/Overview&gt;
2520
+ &lt;Schedule&gt;
2521
+ &lt;Impressions&gt;999&lt;/Impressions&gt;
2522
+ &lt;Clicks&gt;0&lt;/Clicks&gt;
2523
+ &lt;Uniques&gt;0&lt;/Uniques&gt;
2524
+ &lt;Weight&gt;10&lt;/Weight&gt;
2525
+ &lt;PriorityLevel&gt;1&lt;/PriorityLevel&gt;
2526
+ &lt;Completion&gt;E&lt;/Completion&gt;
2527
+ &lt;StartDate&gt;2005-12-01&lt;/StartDate&gt;
2528
+ &lt;EndDate&gt;2040-12-01&lt;/EndDate&gt;
2529
+ &lt;Reach&gt;O&lt;/Reach&gt;
2530
+ &lt;DailyImp&gt;99&lt;/DailyImp&gt;
2531
+ &lt;DailyClicks&gt;9&lt;/DailyClicks&gt;
2532
+ &lt;DailyUniq&gt;1&lt;/DailyUniq&gt;
2533
+ &lt;SmoothOrAsap&gt;S&lt;/SmoothOrAsap&gt;
2534
+ &lt;ImpOverrun&gt;2&lt;/ImpOverrun&gt;
2535
+ &lt;CompanionPositions&gt;
2536
+ &lt;CompanionPosition&gt;B/T&lt;/CompanionPosition&gt;
2537
+ &lt;CompanionPosition&gt;BL/TL&lt;/CompanionPosition&gt;
2538
+ &lt;/CompanionPositions&gt;
2539
+ &lt;StrictCompanions&gt;Y&lt;/StrictCompanions&gt;
2540
+ &lt;HourOfDay&gt;
2541
+ &lt;Hour&gt;00&lt;/Hour&gt;
2542
+ &lt;Hour&gt;01&lt;/Hour&gt;
2543
+ &lt;Hour&gt;23&lt;/Hour&gt;
2544
+ &lt;/HourOfDay&gt;
2545
+ &lt;DayOfWeek&gt;
2546
+ &lt;Day&gt;2&lt;/Day&gt;
2547
+ &lt;Day&gt;3&lt;/Day&gt;
2548
+ &lt;Day&gt;4&lt;/Day&gt;
2549
+ &lt;Day&gt;5&lt;/Day&gt;
2550
+ &lt;/DayOfWeek&gt;
2551
+ &lt;UserTimeZone&gt;Y&lt;/UserTimeZone&gt;
2552
+ &lt;Sections&gt;
2553
+ &lt;SectionId&gt;SectionABC&lt;/SectionId&gt;
2554
+ &lt;SectionId&gt;SectionDEF&lt;/SectionId&gt;
2555
+ &lt;/Sections&gt;
2556
+ &lt;/Schedule&gt;
2557
+ &lt;/Campaign&gt;
2558
+ &lt;/Request&gt;
2559
+ &lt;/AdXML&gt;
2560
+ </String_4></n1:OasXmlRequest></env:Body></env:Envelope>
2561
+ headers:
2562
+ content-type:
2563
+ - text/xml;charset=UTF-8
2564
+ soapaction:
2565
+ - "\"OasXmlRequest\""
2566
+ response: !ruby/struct:VCR::Response
2567
+ status: !ruby/struct:VCR::ResponseStatus
2568
+ code: 200
2569
+ message: OK
2570
+ headers:
2571
+ x-powered-by:
2572
+ - Servlet 2.5; JBoss-5.0/JBossWeb-2.1
2573
+ p3p:
2574
+ - CP="NON NID PSAa PSDa OUR IND UNI COM NAV STA",policyref="/w3c/p3p.xml"
2575
+ content-type:
2576
+ - text/xml;charset=UTF-8
2577
+ via:
2578
+ - 1.1 training7.247realmedia.com
2579
+ server:
2580
+ - Apache-Coyote/1.1
2581
+ date:
2582
+ - Wed, 01 Jun 2011 19:20:49 GMT
2583
+ transfer-encoding:
2584
+ - chunked
2585
+ body: |-
2586
+ <?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'?>
2587
+ &lt;AdXML>
2588
+
2434
2589
  &lt;Response>
2435
2590
  &lt;Campaign>Successfully added.&lt;/Campaign>
2436
2591
  &lt;/Response>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rodrigo Navarro