yieldmanager 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDAzYzI0NjQ5YmNlZmQ3ODkyYWM2ODhhMDBkMTJhNzljMjBhZTRhNw==
5
+ data.tar.gz: !binary |-
6
+ MDM3MDdmN2ViMjg0ODA1ZTk4YTdhNDI0YzViNjQ2ODFhMmFkNjZjYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzBmZjA0ZTFjNjVmMTIwMGFjNTBkNDA3NGRkZmRlOTNhYzNiNWNjN2QzODI0
10
+ ODQyYWFlNjkwNGI5YjdmZjdiYzE2MWUxMjVhODVlNzYyYjRiMmUyNDMyMDJk
11
+ MjRkMGFhZDQ1MWFmNzUwZTAyMjU1NmE1ZmUxMDk3ZGIyOGZlZDc=
12
+ data.tar.gz: !binary |-
13
+ Y2JmNjg2Zjg5MmE3MDkyYmQyN2NiNGYxOTY3MGM2YWZjY2E3YzQ1NzMxMzU5
14
+ NTNkNzYxZmJhYTgwYWQ4Y2FmZTYzYmVmNGIwOGJhM2ZjNWRkNDRiOWU4MWJi
15
+ Y2I4ODVlOGQyMzI2MjQwYzc5ZWFiZDk0YzAzMGM0YzMxMTk1Mzc=
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0
5
+ - jruby-19mode
6
+ env:
7
+ global:
8
+ - secure: AO8pJu1f0xY/Evuf2G+l3v9ozwaaiNP1wiX8gbSRE2DoEuyghTlUBwQHCOUg0M6bq8gTvD8O7HeE9egUQ24c9Z1lA8Yr08A+WKwmf9i30iXdTffdonATyJ6fp6m6zpSQf0N+/ApXDKABpKJ671yLhRnaSho1/EdIauMvDze3gkg=
9
+ - secure: ZFxeI+npRXNbhQNIWNu1/MOl6fbNt84kD7AJF62E/LfjEVQZKohm6Zfm2pUrfAF7UWGnpb/ZYDusj3EnzazyUvfkd8Gj40XWXwjv0jvfnV3p8yUkAIbHKlEQqKWnbppMM7i0z+uAyJW1VFU/H50ZiuaPXTdB4LzJXH2crJQXnaQ=
10
+ - secure: A8iYjMBh3OPznTKD/rPztz3tWGBrdJzmlakf3JrTLLWfHHxCE+lHip/Z/EVvTb3ec37owNjh0W8Z8yTPkz54FM++tM/t/W/eR8c71y2V4SI6ln+0wv5Uh5WNqVYpCsAn1DiZ3W4j1LpMGKbnw5ShyV89wfefC2JV55jQorQbth8=
11
+ - secure: TE+/zUZh6brUT4q/oIKqgQH8P4mMPdeav+gUiRvkh5mtwX0HCPMW1Eq7+AoaxsTvksQfUbQLaObGGuQ3xn6ZkiE98lG6y1rk/3Q7keZLQ7zHDP2ucxAtRS/YBTKlcY5yVaj3oRoG4J0XGvN18YNXKB7jRb95HsIRIpSVmvbDjKA=
data/API_VERSION CHANGED
@@ -1 +1 @@
1
- 1.36
1
+ 1.37
data/AVAILABLE_SERVICES CHANGED
@@ -1,8 +1,10 @@
1
1
  AdjustmentService
2
2
  AdvertiserDomainService
3
+ BuyingTermsService
3
4
  CampaignService
4
5
  ContactService
5
6
  CreativeService
7
+ DemandBlockListService
6
8
  DictionaryService
7
9
  EntityService
8
10
  InsertionOrderService
@@ -10,7 +12,9 @@ InventoryVisibilityControlsService
10
12
  LineItemService
11
13
  LinkingService
12
14
  NotificationService
15
+ PassbackService
13
16
  PixelService
17
+ PreferredTermsService
14
18
  PublisherReservePriceService
15
19
  QuotaService
16
20
  ReportService
@@ -19,5 +23,7 @@ SearchService
19
23
  SectionService
20
24
  SegmentDefinitionService
21
25
  SegmentService
26
+ SitelistService
22
27
  SiteService
28
+ SupplyBlocklistService
23
29
  TargetProfileService
@@ -4,6 +4,7 @@ When RightMedia updates their release (say, from 1.33 to 1.34), do this:
4
4
  - Edit the API_VERSION file to match the new release
5
5
  - Visit the main API doc page (https://api.yieldmanager.com/doc/) and make sure the AVAILABLE_SERVICES file exactly matches the services listed in the sidebar.
6
6
  - Run all the specs using 'rake' to ensure nothing broke
7
+ - Commit/push changes and confirm Travis builds on all rubies we support
7
8
  - Bump the VERSION in lib/yieldmanager/version.rb appropriately
8
9
  - 'rake release' to cut a version and push to rubygems.org
9
10
 
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # yieldmanager
2
2
 
3
+ [![Build Status](https://travis-ci.org/billgathen/yieldmanager.png)](https://travis-ci.org/billgathen/yieldmanager)
4
+
3
5
  This gem offers read/write access to [YieldManager's API tools](https://api.yieldmanager.com/doc/) and
4
6
  ad-hoc reporting through the Reportware tool.
5
7
 
@@ -134,6 +136,15 @@ crafted one from scratch. Assuming it's in a variable called
134
136
  end
135
137
  ```
136
138
 
139
+ For large reports it may be necessary to increase the request
140
+ timeout, which has a default value of 300 seconds. You may do
141
+ so by passing in an additional argument to **pull_report**:
142
+
143
+ ```ruby
144
+ max_wait_seconds = 600
145
+ @ym.pull_report(token, request_xml, max_wait_seconds)
146
+ ```
147
+
137
148
  Column data can be accessed either by index or column name:
138
149
 
139
150
  ```ruby
@@ -218,8 +229,10 @@ wrap your logic in a begin/ensure clause and call end_session from the ensure.
218
229
  * Send me a pull request. Bonus points for topic branches.
219
230
 
220
231
  ## Thanks for contributing!
221
- * manlycode[https://github.com/manlycode] (Chris Rittersdorf)
222
- * KarateCode[https://github.com/KarateCode] (Michael Schneider)
232
+ * [manlycode](https://github.com/manlycode)
233
+ * [KarateCode](https://github.com/KarateCode)
234
+ * [budnik](https://github.com/budnik)
235
+ * [walsh1kt](http://github.com/walsh1kt)
223
236
 
224
237
  ## Copyright
225
238
 
@@ -171,9 +171,9 @@ module Yieldmanager
171
171
  # Pulls report from RightMedia, returned as Yieldmanager::Report
172
172
  #
173
173
  # Must be called within the context of a session
174
- def pull_report token, xml
174
+ def pull_report token, xml, max_wait_seconds=300
175
175
  report = Yieldmanager::Report.new
176
- report.pull(token, self.report, xml)
176
+ report.pull(token, self.report, xml, max_wait_seconds)
177
177
  report
178
178
  end
179
179
 
@@ -33,9 +33,9 @@ module Yieldmanager
33
33
  @data = []
34
34
  end
35
35
 
36
- def pull token, report, xml
36
+ def pull token, report, xml, max_wait_seconds
37
37
  report_token = request_report_token token, report, xml
38
- report_url = retrieve_report_url token, report, report_token
38
+ report_url = retrieve_report_url token, report, report_token, max_wait_seconds
39
39
  retrieve_data report_url
40
40
  end
41
41
 
@@ -67,16 +67,24 @@ private
67
67
  report.requestViaXML(token,xml)
68
68
  end
69
69
 
70
- def retrieve_report_url token, report, report_token
70
+ def retrieve_report_url token, report, report_token, max_wait_seconds
71
71
  report_url = nil
72
- 60.times do |secs| # Poll until report ready
72
+ start_time = Time.now
73
+
74
+ until over_max_time(start_time,max_wait_seconds)
73
75
  report_url = report.status(token,report_token)
74
76
  break if report_url
75
77
  pause
76
78
  end
79
+
80
+ raise "Report timed out after #{max_wait_seconds} seconds. Consider using the optional max_wait_seconds argument in the pull method." unless report_url
77
81
  report_url
78
82
  end
79
83
 
84
+ def over_max_time start_time, max_wait_seconds
85
+ Time.now.to_i - start_time.to_i > max_wait_seconds.to_i
86
+ end
87
+
80
88
  def retrieve_data url
81
89
  retries = 5
82
90
  doc = nil
@@ -1,3 +1,3 @@
1
1
  module Yieldmanager
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
@@ -133,8 +133,11 @@ describe "A new Yieldmanager client" do
133
133
  :imp_budget => 0,
134
134
  :priority => "Normal"
135
135
  }
136
- lambda { @ym.session { |t| @ym.line_item.add(t,l) } }.
137
- should_not raise_error(/enum_ym_numbers_difference: cannot accept ''/)
136
+ begin
137
+ @ym.session { |t| @ym.line_item.add(t,l) }
138
+ rescue Exception => e
139
+ expect(e.message).not_to match(/enum_ym_numbers_difference: cannot accept ''/)
140
+ end
138
141
  end
139
142
 
140
143
  describe "A Yieldmanager report" do
@@ -7,61 +7,61 @@ Please set these environment variables to match your Yieldmanager account:
7
7
  * YIELDMANAGER_CONTACT_ID (get this from the contact_id attribute in any UI-created reportware report)
8
8
  * YIELDMANAGER_IP_ADDRESS (your external IP address)
9
9
  EOM
10
-
10
+
11
11
  describe "A Yieldmanager report request" do
12
12
 
13
13
  before(:each) do
14
14
  @ym = Yieldmanager::Client.new(login_args)
15
15
  @sample_report = File.join(File.dirname(__FILE__), '..', 'reports', 'sample_report.xml')
16
16
  end
17
-
17
+
18
18
  it "returns report object" do
19
19
  @ym.session do |token|
20
20
  rpt = @ym.pull_report(token, request_xml)
21
21
  rpt.should be_instance_of(Yieldmanager::Report)
22
22
  end
23
23
  end
24
-
24
+
25
25
  it "makes request and returns report token" do
26
26
  @ym.session do |token|
27
27
  rpt = Yieldmanager::Report.new
28
28
  rpt.send(:request_report_token, token, @ym.report, request_xml).should_not be_nil
29
29
  end
30
30
  end
31
-
31
+
32
32
  it "uses report token to pull report url" do
33
33
  @ym.session do |token|
34
34
  rpt = Yieldmanager::Report.new
35
35
  report_token = rpt.send(:request_report_token, token, @ym.report, request_xml)
36
- report_url = rpt.send(:retrieve_report_url, token, @ym.report, report_token)
36
+ report_url = rpt.send(:retrieve_report_url, token, @ym.report, report_token, 300)
37
37
  report_url.should_not be_nil
38
38
  end
39
39
  end
40
-
40
+
41
41
  it "uses report url to pull report" do
42
42
  @ym.session do |token|
43
43
  rpt = Yieldmanager::Report.new
44
44
  report_token = rpt.send(:request_report_token, token, @ym.report, request_xml)
45
- report_url = rpt.send(:retrieve_report_url, token, @ym.report, report_token)
45
+ report_url = rpt.send(:retrieve_report_url, token, @ym.report, report_token, 300)
46
46
 
47
47
  rpt.send(:retrieve_data, report_url)
48
48
  rpt.headers[0].should == "advertiser_name"
49
49
  end
50
50
  end
51
-
51
+
52
52
  it "offers data as array of arrays" do
53
53
  report = Yieldmanager::Report.new
54
54
  report.send(:retrieve_data, @sample_report)
55
55
  report.data[0][0].should == "one"
56
56
  end
57
-
57
+
58
58
  it "offers data by name" do
59
59
  report = Yieldmanager::Report.new
60
60
  report.send(:retrieve_data, @sample_report)
61
61
  report.data[0].by_name('first').should == "one"
62
62
  report.data[1].by_name(:second).should == "2"
63
63
  end
64
-
64
+
65
65
  it "offers data as array of hashes" do
66
66
  report = Yieldmanager::Report.new
67
67
  report.send(:retrieve_data, @sample_report)
@@ -104,7 +104,31 @@ describe "A Yieldmanager report request" do
104
104
  report.stub(:pause) {} # don't make me wait
105
105
  expect{ report.send(:retrieve_data,"http://i_dont_exist.com") }.to raise_error
106
106
  end
107
-
107
+
108
+ it "complains if report URL doesn't exist before retries" do
109
+ @ym.session do |token|
110
+ report = Yieldmanager::Report.new
111
+ Yieldmanager::Report.any_instance.stub(:status)
112
+ report.should_receive(:over_max_time).and_return(true)
113
+ report.stub(:pause) {} # don't make me wait
114
+ expect{ report.send(:retrieve_report_url, token, @ym.report, request_xml, 1) }.to raise_error(/Report timed out after 1 second./)
115
+ end
116
+ end
117
+
118
+ it "responds correctly when not over max time" do
119
+ start_time = Time.now-5
120
+ max_wait_seconds = 5
121
+ report = Yieldmanager::Report.new
122
+ report.send(:over_max_time, start_time, max_wait_seconds).should == false
123
+ end
124
+
125
+ it "responds correctly when over max time" do
126
+ start_time = Time.now-6
127
+ max_wait_seconds = 5
128
+ report = Yieldmanager::Report.new
129
+ report.send(:over_max_time, start_time, max_wait_seconds).should == true
130
+ end
131
+
108
132
  def login_args
109
133
  unless ENV["YIELDMANAGER_USER"] &&
110
134
  ENV["YIELDMANAGER_PASS"]
data/yieldmanager.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://github.com/billgathen/yieldmanager"
12
12
  s.summary = %q{YieldManager API Tool}
13
13
  s.description = %q{This gem offers full access to YieldManager's API tools (read/write) as well as ad-hoc reporting through the Reportware tool}
14
+ s.license = "MIT"
14
15
 
15
16
  s.files = `git ls-files`.split("\n")
16
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yieldmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
5
- prerelease:
4
+ version: 0.9.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bill Gathen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-18 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rdoc
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: nokogiri
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: soap4r
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - '='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - '='
92
81
  - !ruby/object:Gem::Version
@@ -103,11 +92,11 @@ files:
103
92
  - .gitignore
104
93
  - .rspec
105
94
  - .ruby-version
95
+ - .travis.yml
106
96
  - API_VERSION
107
97
  - AVAILABLE_SERVICES
108
98
  - Gemfile
109
99
  - HOW_TO_UPDATE_API_VERSION
110
- - LICENSE
111
100
  - README.md
112
101
  - Rakefile
113
102
  - TODO
@@ -132,34 +121,28 @@ files:
132
121
  - spec/yieldmanager/report_spec.rb
133
122
  - yieldmanager.gemspec
134
123
  homepage: http://github.com/billgathen/yieldmanager
135
- licenses: []
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
136
127
  post_install_message:
137
128
  rdoc_options: []
138
129
  require_paths:
139
130
  - lib
140
131
  required_ruby_version: !ruby/object:Gem::Requirement
141
- none: false
142
132
  requirements:
143
133
  - - ! '>='
144
134
  - !ruby/object:Gem::Version
145
135
  version: '0'
146
- segments:
147
- - 0
148
- hash: -1212190755149832978
149
136
  required_rubygems_version: !ruby/object:Gem::Requirement
150
- none: false
151
137
  requirements:
152
138
  - - ! '>='
153
139
  - !ruby/object:Gem::Version
154
140
  version: '0'
155
- segments:
156
- - 0
157
- hash: -1212190755149832978
158
141
  requirements: []
159
142
  rubyforge_project:
160
- rubygems_version: 1.8.25
143
+ rubygems_version: 2.1.10
161
144
  signing_key:
162
- specification_version: 3
145
+ specification_version: 4
163
146
  summary: YieldManager API Tool
164
147
  test_files:
165
148
  - spec/patch_detector_spec.rb
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2009 Bill Gathen
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.