oas 0.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Oas::Client do
|
4
|
-
describe "campaign" do
|
5
|
-
before(:each) do
|
6
|
-
stub_api_call fixture("read_campaign.xml")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should return a campaign hash for a given id" do
|
10
|
-
response = Oas.campaign("campaign_id")
|
11
|
-
response.should_not be_nil
|
12
|
-
response[:Campaign].should be_a(Hash)
|
13
|
-
response[:Campaign][:Overview][:Id].should eq("campaign_id")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "creative" do
|
18
|
-
before(:each) do
|
19
|
-
stub_api_call fixture("read_creative.xml")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should return a campaign hash for a given id" do
|
23
|
-
response = Oas.creative("campaign_id", "creative_id")
|
24
|
-
response.should_not be_nil
|
25
|
-
response[:Creative].should be_a(Hash)
|
26
|
-
response[:Creative][:CampaignId].should eq("campaign_id")
|
27
|
-
response[:Creative][:Id].should eq("creative_id")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Oas::Client do
|
4
|
-
describe "advertiser" do
|
5
|
-
before(:each) do
|
6
|
-
stub_api_call fixture("read_advertiser.xml")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should return an advertiser hash for a given id" do
|
10
|
-
response = Oas.advertiser("advertiser_id")
|
11
|
-
response.should_not be_nil
|
12
|
-
response[:Advertiser][:Id].should eq("advertiser_id")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "agency" do
|
17
|
-
before(:each) do
|
18
|
-
stub_api_call fixture("read_agency.xml")
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return an agency hash for a given id" do
|
22
|
-
response = Oas.agency("agency_id")
|
23
|
-
response.should_not be_nil
|
24
|
-
response[:Agency][:Id].should eq("agency_id")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "campaign_group" do
|
29
|
-
before(:each) do
|
30
|
-
stub_api_call fixture("read_campaign_group.xml")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should return a campaign_group hash for a given id" do
|
34
|
-
response = Oas.campaign_group("campaign_group_id")
|
35
|
-
response.should_not be_nil
|
36
|
-
response[:CampaignGroup][:Id].should eq("campaign_group_id")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "keyname" do
|
41
|
-
before(:each) do
|
42
|
-
stub_api_call fixture("read_keyname.xml")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return a keyname hash for a given id" do
|
46
|
-
response = Oas.keyname("keyname_name")
|
47
|
-
response.should_not be_nil
|
48
|
-
response[:Keyname][:Name].should eq("keyname_name")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "keyword" do
|
53
|
-
before(:each) do
|
54
|
-
stub_api_call fixture("read_keyword.xml")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should return a keyword hash for a given id" do
|
58
|
-
response = Oas.keyword("keyword_id")
|
59
|
-
response.should_not be_nil
|
60
|
-
response[:Keyword][:Id].should eq("keyword_id")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "page" do
|
65
|
-
before(:each) do
|
66
|
-
stub_api_call fixture("read_page.xml")
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should return a page hash for a given id" do
|
70
|
-
response = Oas.page("page_url")
|
71
|
-
response.should_not be_nil
|
72
|
-
response[:Page][:Url].should eq("page_url")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "section" do
|
77
|
-
before(:each) do
|
78
|
-
stub_api_call fixture("read_section.xml")
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should return a section hash for a given id" do
|
82
|
-
response = Oas.section("section_id")
|
83
|
-
response.should_not be_nil
|
84
|
-
response[:Section][:Id].should eq("section_id")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe "site" do
|
89
|
-
before(:each) do
|
90
|
-
stub_api_call fixture("read_site.xml")
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should return a site hash for a given id" do
|
94
|
-
response = Oas.site("site_id")
|
95
|
-
response.should_not be_nil
|
96
|
-
response[:Site][:Id].should eq("site_id")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "site_group" do
|
101
|
-
before(:each) do
|
102
|
-
stub_api_call fixture("read_site_group.xml")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should return a site_group hash for a given id" do
|
106
|
-
response = Oas.site_group("site_group_id")
|
107
|
-
response.should_not be_nil
|
108
|
-
response[:SiteGroup][:Id].should eq("site_group_id")
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Oas::Client do
|
4
|
-
describe "notification" do
|
5
|
-
before(:each) do
|
6
|
-
stub_api_call fixture("read_notification.xml")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should return a notification hash for a given campaign_id and event_name" do
|
10
|
-
response = Oas.notification("campaign_id", "event_name")
|
11
|
-
response.should_not be_nil
|
12
|
-
response[:Notification][:CampaignId].should eq("campaign_id")
|
13
|
-
response[:Notification][:EventName].should eq("event_name")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/spec/oas_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Oas do
|
4
|
-
describe ".configure" do
|
5
|
-
Oas::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
6
|
-
it "should set the #{key}" do
|
7
|
-
Oas.configure do |config|
|
8
|
-
config.send("#{key}=", key)
|
9
|
-
Oas.send(key).should == key
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'oas'
|
2
|
-
require 'rspec'
|
3
|
-
require "webmock/rspec"
|
4
|
-
|
5
|
-
# Requires supporting files with custom matchers and macros, etc,
|
6
|
-
# in ./support/ and its subdirectories.
|
7
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
8
|
-
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.include WebMock::API
|
11
|
-
config.before(:each) { stub_wsdl }
|
12
|
-
config.after(:each) { Oas.reset }
|
13
|
-
end
|
14
|
-
|
15
|
-
def fixture_path
|
16
|
-
File.expand_path("../fixtures", __FILE__)
|
17
|
-
end
|
18
|
-
|
19
|
-
def fixture(file)
|
20
|
-
File.new(fixture_path + '/' + file)
|
21
|
-
end
|
22
|
-
|
23
|
-
def stub_wsdl(status = 200)
|
24
|
-
stub_request(:get, Oas.endpoint).to_return(:status => status, :body => fixture("wsdl.xml"))
|
25
|
-
end
|
26
|
-
|
27
|
-
def stub_api_call(body = nil, status = 200)
|
28
|
-
stub_request(:post, "https://oas.realmedianetwork.net:443/oasapi/OaxApi").to_return(:status => status, :body => body, :headers => {:content_type => "text/xml;charset=utf-8"})
|
29
|
-
end
|