oas 0.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -6
- data/.travis.yml +9 -3
- data/Gemfile +4 -4
- data/LICENSE +20 -20
- data/README.md +47 -0
- data/Rakefile +11 -8
- data/lib/oas.rb +19 -31
- data/lib/oas/client.rb +39 -17
- data/lib/oas/configuration.rb +45 -45
- data/lib/oas/response.rb +31 -0
- data/lib/oas/version.rb +3 -3
- data/oas.gemspec +30 -29
- data/test/fixtures/successful_response.xml +15 -0
- data/test/helper.rb +6 -0
- data/test/test_client.rb +49 -0
- data/test/test_oas.rb +15 -0
- data/test/test_response.rb +22 -0
- metadata +85 -61
- data/.rspec +0 -2
- data/README.markdown +0 -103
- data/lib/oas/api.rb +0 -56
- data/lib/oas/client/campaigns.rb +0 -25
- data/lib/oas/client/databases.rb +0 -96
- data/lib/oas/client/notifications.rb +0 -15
- data/lib/oas/client/reports.rb +0 -71
- data/lib/oas/client/utils.rb +0 -16
- data/lib/oas/core_ext/hash.rb +0 -57
- data/lib/oas/core_ext/object.rb +0 -6
- data/lib/oas/error.rb +0 -17
- data/spec/fixtures/read_advertiser.xml +0 -49
- data/spec/fixtures/read_agency.xml +0 -49
- data/spec/fixtures/read_campaign.xml +0 -121
- data/spec/fixtures/read_campaign_group.xml +0 -31
- data/spec/fixtures/read_creative.xml +0 -52
- data/spec/fixtures/read_keyname.xml +0 -29
- data/spec/fixtures/read_keyword.xml +0 -27
- data/spec/fixtures/read_notification.xml +0 -31
- data/spec/fixtures/read_page.xml +0 -33
- data/spec/fixtures/read_section.xml +0 -30
- data/spec/fixtures/read_site.xml +0 -32
- data/spec/fixtures/read_site_group.xml +0 -33
- data/spec/fixtures/wsdl.xml +0 -37
- data/spec/oas/client/campaigns_spec.rb +0 -30
- data/spec/oas/client/databases_spec.rb +0 -111
- data/spec/oas/client/notifications_spec.rb +0 -16
- data/spec/oas_spec.rb +0 -14
- data/spec/spec_helper.rb +0 -29
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
3
|
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
4
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
5
|
+
<soapenv:Body>
|
6
|
+
<ns1:OasXmlRequestResponse xmlns:ns1="http://api.oas.tfsm.com/">
|
7
|
+
<result>
|
8
|
+
<![CDATA[
|
9
|
+
<?xml version="1.0"?>
|
10
|
+
<AdXML><Response></Response></AdXML>
|
11
|
+
]]>
|
12
|
+
</result>
|
13
|
+
</ns1:OasXmlRequestResponse>
|
14
|
+
</soapenv:Body>
|
15
|
+
</soapenv:Envelope>
|
data/test/helper.rb
ADDED
data/test/test_client.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'webmock'
|
3
|
+
|
4
|
+
class TestClient < MiniTest::Unit::TestCase
|
5
|
+
include WebMock::API
|
6
|
+
|
7
|
+
def setup
|
8
|
+
OAS.reset!
|
9
|
+
@client = OAS::Client.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
WebMock.reset!
|
14
|
+
end
|
15
|
+
|
16
|
+
def fixture(file)
|
17
|
+
File.new(File.join(File.expand_path("../fixtures", __FILE__), file))
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_call_with_string_xml
|
21
|
+
res = Class.new do
|
22
|
+
def body; { :oas_xml_request_response => { :result => "<AdXML></AdXML>" } } end
|
23
|
+
end.new
|
24
|
+
@client.driver = MiniTest::Mock.new
|
25
|
+
@client.driver.expect :call, res, [:oas_xml_request, message: Hash["String_1", @client.account.to_s, "String_2", @client.username.to_s, "String_3", @client.password.to_s, "String_4", "<AdXML></AdXML>"]]
|
26
|
+
@client.request("<AdXML></AdXML>")
|
27
|
+
@client.driver.verify
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_call_with_object_respond_to_xml
|
31
|
+
doc = Class.new do
|
32
|
+
def to_xml; "<AdXML></AdXML>" end
|
33
|
+
end.new
|
34
|
+
res = Class.new do
|
35
|
+
def body; { :oas_xml_request_response => { :result => "<AdXML></AdXML>" } } end
|
36
|
+
end.new
|
37
|
+
@client.driver = MiniTest::Mock.new
|
38
|
+
@client.driver.expect :call, res, [:oas_xml_request, message: Hash["String_1", @client.account.to_s, "String_2", @client.username.to_s, "String_3", @client.password.to_s, "String_4", doc.to_xml]]
|
39
|
+
@client.request(doc)
|
40
|
+
@client.driver.verify
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_correctly_parse_soap_response
|
44
|
+
stub_request(:post, @client.endpoint.to_s)
|
45
|
+
.to_return(:status => 200, :body => fixture("successful_response.xml"))
|
46
|
+
res = @client.request("<AdXML></AdXML>")
|
47
|
+
assert_kind_of OAS::Response, res
|
48
|
+
end
|
49
|
+
end
|
data/test/test_oas.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestOas < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
describe "#configure" do
|
6
|
+
OAS::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
7
|
+
it "should set the #{key}" do
|
8
|
+
OAS.configure do |config|
|
9
|
+
config.send("#{key}=", key)
|
10
|
+
assert_equal key, OAS.send(key)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestResponse < MiniTest::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
doc = <<EOF
|
6
|
+
<AdXML>
|
7
|
+
<Response>
|
8
|
+
</Response>
|
9
|
+
</AdXML>
|
10
|
+
EOF
|
11
|
+
@response = OAS::Response.new(doc)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_convert_to_hash
|
15
|
+
assert @response.to_hash.has_key?(:AdXML)
|
16
|
+
assert @response.to_hash[:AdXML].has_key?(:Response)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_convert_to_string_without_spaces_and_line_breaks
|
20
|
+
assert_equal "<AdXML><Response></Response></AdXML>", @response.to_s
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,75 +9,121 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httpclient
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: '2.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.3'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
31
|
+
name: savon
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
37
|
+
version: '2.0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
47
|
+
name: nori
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
42
52
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0
|
53
|
+
version: '2.0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
63
|
+
name: minitest
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
69
|
+
version: '4.3'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '4.3'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
79
|
+
name: webmock
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
64
84
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
85
|
+
version: '1.9'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: webmock
|
71
|
-
requirement: &70670080 !ruby/object:Gem::Requirement
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
89
|
none: false
|
73
90
|
requirements:
|
74
91
|
- - ~>
|
75
92
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.
|
93
|
+
version: '1.9'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
80
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: simplecov
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Ruby client for the OpenAdstream API
|
81
127
|
email:
|
82
128
|
- damian.caruso@gmail.com
|
83
129
|
executables: []
|
@@ -85,45 +131,23 @@ extensions: []
|
|
85
131
|
extra_rdoc_files: []
|
86
132
|
files:
|
87
133
|
- .gitignore
|
88
|
-
- .rspec
|
89
134
|
- .travis.yml
|
90
135
|
- Gemfile
|
91
136
|
- LICENSE
|
92
|
-
- README.
|
137
|
+
- README.md
|
93
138
|
- Rakefile
|
94
139
|
- lib/oas.rb
|
95
|
-
- lib/oas/api.rb
|
96
140
|
- lib/oas/client.rb
|
97
|
-
- lib/oas/client/campaigns.rb
|
98
|
-
- lib/oas/client/databases.rb
|
99
|
-
- lib/oas/client/notifications.rb
|
100
|
-
- lib/oas/client/reports.rb
|
101
|
-
- lib/oas/client/utils.rb
|
102
141
|
- lib/oas/configuration.rb
|
103
|
-
- lib/oas/
|
104
|
-
- lib/oas/core_ext/object.rb
|
105
|
-
- lib/oas/error.rb
|
142
|
+
- lib/oas/response.rb
|
106
143
|
- lib/oas/version.rb
|
107
144
|
- oas.gemspec
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
|
114
|
-
- spec/fixtures/read_keyword.xml
|
115
|
-
- spec/fixtures/read_notification.xml
|
116
|
-
- spec/fixtures/read_page.xml
|
117
|
-
- spec/fixtures/read_section.xml
|
118
|
-
- spec/fixtures/read_site.xml
|
119
|
-
- spec/fixtures/read_site_group.xml
|
120
|
-
- spec/fixtures/wsdl.xml
|
121
|
-
- spec/oas/client/campaigns_spec.rb
|
122
|
-
- spec/oas/client/databases_spec.rb
|
123
|
-
- spec/oas/client/notifications_spec.rb
|
124
|
-
- spec/oas_spec.rb
|
125
|
-
- spec/spec_helper.rb
|
126
|
-
homepage: http://github.com/realmedia/ruby-oas
|
145
|
+
- test/fixtures/successful_response.xml
|
146
|
+
- test/helper.rb
|
147
|
+
- test/test_client.rb
|
148
|
+
- test/test_oas.rb
|
149
|
+
- test/test_response.rb
|
150
|
+
homepage: http://github.com/realmedia/oas-ruby-client
|
127
151
|
licenses: []
|
128
152
|
post_install_message:
|
129
153
|
rdoc_options: []
|
@@ -137,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
161
|
version: '0'
|
138
162
|
segments:
|
139
163
|
- 0
|
140
|
-
hash:
|
164
|
+
hash: 67502451
|
141
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
166
|
none: false
|
143
167
|
requirements:
|
@@ -146,11 +170,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
170
|
version: '0'
|
147
171
|
segments:
|
148
172
|
- 0
|
149
|
-
hash:
|
173
|
+
hash: 67502451
|
150
174
|
requirements: []
|
151
175
|
rubyforge_project: oas
|
152
|
-
rubygems_version: 1.8.
|
176
|
+
rubygems_version: 1.8.24
|
153
177
|
signing_key:
|
154
178
|
specification_version: 3
|
155
|
-
summary: Ruby
|
179
|
+
summary: Ruby client for the OpenAdstream API
|
156
180
|
test_files: []
|
data/.rspec
DELETED
data/README.markdown
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
OAS API Ruby Gem
|
2
|
-
====================
|
3
|
-
A Ruby wrapper for OAS 7.4 API
|
4
|
-
|
5
|
-
Installation
|
6
|
-
------------
|
7
|
-
gem install oas
|
8
|
-
|
9
|
-
Usage Examples
|
10
|
-
--------------
|
11
|
-
require "rubygems"
|
12
|
-
require "oas"
|
13
|
-
|
14
|
-
# All methods require authentication.
|
15
|
-
Oas.configure do |config|
|
16
|
-
config.endpoint = WSDL_URI
|
17
|
-
config.account = YOUR_OAS_ACCOUNT
|
18
|
-
config.username = YOUR_USERNAME
|
19
|
-
config.password = YOUR_PASSWORD
|
20
|
-
end
|
21
|
-
|
22
|
-
# Read an advertiser
|
23
|
-
puts Oas.advertiser("advertiser_id")
|
24
|
-
|
25
|
-
# Read an agency
|
26
|
-
puts Oas.agency("agency_id")
|
27
|
-
|
28
|
-
# Read a campaign
|
29
|
-
puts Oas.campaign("campaign_id")
|
30
|
-
|
31
|
-
# Read a campaign group
|
32
|
-
puts Oas.campaign_group("campaign_group_id")
|
33
|
-
|
34
|
-
# Read a creative
|
35
|
-
puts Oas.creative("campaign_id", "creative_id")
|
36
|
-
|
37
|
-
# Read a keyname
|
38
|
-
puts Oas.keyname("keyname")
|
39
|
-
|
40
|
-
# Read a keyword
|
41
|
-
puts Oas.keyword("keyword_id")
|
42
|
-
|
43
|
-
# Read a notification
|
44
|
-
puts Oas.notification("campaign_id", "event_name")
|
45
|
-
|
46
|
-
# Read a page
|
47
|
-
puts Oas.page("page_url")
|
48
|
-
|
49
|
-
# Read a section
|
50
|
-
puts Oas.section("section_id")
|
51
|
-
|
52
|
-
# Read a site
|
53
|
-
puts Oas.site("site_id")
|
54
|
-
|
55
|
-
# Read a site group
|
56
|
-
puts Oas.site_group("site_group_id")
|
57
|
-
|
58
|
-
# Reports
|
59
|
-
# StartDate defaults to first time in history
|
60
|
-
# EndDate defaults to Date.today
|
61
|
-
|
62
|
-
# Get advertiser reports
|
63
|
-
puts Oas.advertiser_report("advertiser_id", "Delivery.Advertiser.Base.T602.01,Delivery.Advertiser.Base.T652.01", "2011/01/01", "2011/01/31")
|
64
|
-
|
65
|
-
# Get campaign reports
|
66
|
-
puts Oas.campaign_report("campaign_id", "Delivery.Campaign.Base.T154.01")
|
67
|
-
|
68
|
-
# Get section reports
|
69
|
-
puts Oas.section_report("section_id", "Delivery.Section.Cookie.T358.01")
|
70
|
-
|
71
|
-
# Get site reports
|
72
|
-
puts Oas.site_report("site_id", "Delivery.Site.Base.T258.01")
|
73
|
-
|
74
|
-
# Get Site Performance Reports
|
75
|
-
puts Oas.site_performance_report("site_id, other_site_id", "2011/01/01", "2011/01/31")
|
76
|
-
|
77
|
-
# Get Page Priority Reports
|
78
|
-
puts Oas.page_priority_report("www.247realmedia.com/home")
|
79
|
-
|
80
|
-
# Get Campaigns Status Report
|
81
|
-
puts Oas.campaign_status_report
|
82
|
-
|
83
|
-
#Execute not implemented request
|
84
|
-
puts Oas.client.request('Site') do |xml|
|
85
|
-
xml.Database(:action => 'list') {
|
86
|
-
xml.SearchCriteria {
|
87
|
-
xml.Id "%"
|
88
|
-
}
|
89
|
-
}
|
90
|
-
end.inspect
|
91
|
-
|
92
|
-
TODO
|
93
|
-
------------
|
94
|
-
|
95
|
-
* Create and update support on Campaign and Database sections.
|
96
|
-
* Listings
|
97
|
-
* Reach and Frequency Reports
|
98
|
-
* Inventory
|
99
|
-
|
100
|
-
Copyright
|
101
|
-
---------
|
102
|
-
Copyright (c) 2011 Realmedia LatinAmerica.
|
103
|
-
See [LICENSE](https://github.com/realmedia/ruby-oas/blob/master/LICENSE) for details.
|