yieldmanager 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.5.0
@@ -26,6 +26,12 @@ module Yieldmanager
26
26
  retrieve_data report_url
27
27
  end
28
28
 
29
+ def add_row row_data
30
+ row = ReportRow.new(self)
31
+ row_data.each { |ele| row << ele }
32
+ data << row
33
+ end
34
+
29
35
  private
30
36
 
31
37
  def request_report_token token, report, xml
@@ -49,7 +55,7 @@ private
49
55
  end
50
56
  (doc/"row").each_with_index do |row_elems,idx|
51
57
  # TODO cast elements to appropriate types based on column attrs
52
- row = ReportRow.new(headers)
58
+ row = ReportRow.new(self)
53
59
  (row_elems/"column").each do |col|
54
60
  row << col.inner_html
55
61
  end
@@ -58,17 +64,16 @@ private
58
64
  end
59
65
 
60
66
  class ReportRow < Array
61
- def initialize headers
62
- @name_lookup = {}
63
- headers.each_with_index do |header, idx|
64
- @name_lookup[header] = idx
65
- end
67
+ def initialize report
68
+ @report = report
66
69
  end
67
70
 
68
71
  def by_name name
69
- at(@name_lookup[name.to_s])
72
+ idx = @report.headers.index(name.to_s)
73
+ raise ArgumentError.new("Column not found: '#{name}'") if idx.nil?
74
+ at(idx)
70
75
  end
71
76
  end
72
77
  end
73
78
 
74
- end
79
+ end
@@ -5,6 +5,10 @@ describe "A build run" do
5
5
  API_VERSION = "1.31"
6
6
  VERSION_DIR = "#{WSDL_DIR}/#{API_VERSION}"
7
7
 
8
+ before do
9
+ pending
10
+ end
11
+
8
12
  it "rejects non-standard api version" do
9
13
  ["", "a", "1"].each do |v|
10
14
  lambda { Yieldmanager::Builder.build_wsdls_for(v) }.should raise_error(ArgumentError)
@@ -54,6 +58,10 @@ describe "A build run" do
54
58
  end
55
59
 
56
60
  describe "A delete run" do
61
+ before do
62
+ pending
63
+ end
64
+
57
65
  it "removes directory structure" do
58
66
  contact_wsdl = "#{VERSION_DIR}/prod/contact.wsdl"
59
67
  contact_wsdl_test = "#{VERSION_DIR}/test/contact.wsdl"
@@ -62,6 +62,34 @@ describe "A Yieldmanager report request" do
62
62
  report.data[0].by_name('first').should == "one"
63
63
  report.data[1].by_name(:second).should == "2"
64
64
  end
65
+
66
+ it "by_name returns 'column not found' error when missing" do
67
+ report = Yieldmanager::Report.new
68
+ report.send(:retrieve_data, @sample_report)
69
+ begin
70
+ report.data.first.by_name('does_not_exist')
71
+ fail "Should have thrown ArgumentError"
72
+ rescue => e
73
+ e.class.name.should == "ArgumentError"
74
+ e.message.should == "Column not found: 'does_not_exist'"
75
+ end
76
+ end
77
+
78
+ it "supports data report faking" do
79
+ report = Yieldmanager::Report.new
80
+ report.headers = ["first","second"]
81
+ report.add_row([1,2])
82
+ report.data.first.by_name("first").should == 1
83
+ report.data.first.by_name("second").should == 2
84
+ end
85
+
86
+ it "supports header name editing after data pull" do
87
+ report = Yieldmanager::Report.new
88
+ report.send(:retrieve_data, @sample_report)
89
+ report.data.first.by_name('first').should == "one"
90
+ report.headers[0] = 'new_first'
91
+ report.data.first.by_name('new_first').should == "one"
92
+ end
65
93
 
66
94
  it "complains if report token is nil"
67
95
 
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0"?>
2
+ <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:api="https://api.yieldmanager.com/QuotaService" xmlns:types="https://api.yieldmanager.com/types" targetNamespace="https://api.yieldmanager.com/QuotaService"><wsdl:import namespace="https://api.yieldmanager.com/types" location="xsd_gen.php"/><wsdl:message name="getQuotaByServiceByMethodInput"><wsdl:part name="token" type="xsd:string"/><wsdl:part name="service_name" type="xsd:string"/><wsdl:part name="service_method" type="xsd:string"/></wsdl:message><wsdl:message name="getQuotaByCmdGroupInput"><wsdl:part name="token" type="xsd:string"/><wsdl:part name="cmdgroup_name" type="xsd:string"/></wsdl:message><wsdl:message name="getQuotaByServiceByMethodOutput"><wsdl:part name="quota" type="types:array_of_quota"/></wsdl:message><wsdl:message name="getQuotaByCmdGroupOutput"><wsdl:part name="quota" type="types:array_of_quota"/></wsdl:message><wsdl:message name="getQuotaByServiceByMethodFault"><wsdl:part name="detail" type="types:exception_detail"/></wsdl:message><wsdl:message name="getQuotaByCmdGroupFault"><wsdl:part name="detail" type="types:exception_detail"/></wsdl:message><wsdl:portType name="QuotaServicePortType"><wsdl:operation name="getQuotaByServiceByMethod"><wsdl:input name="getQuotaByServiceByMethodInput" message="api:getQuotaByServiceByMethodInput"/><wsdl:output name="getQuotaByServiceByMethodOutput" message="api:getQuotaByServiceByMethodOutput"/><wsdl:fault name="getQuotaByServiceByMethodFault" message="api:getQuotaByServiceByMethodFault"/></wsdl:operation><wsdl:operation name="getQuotaByCmdGroup"><wsdl:input name="getQuotaByCmdGroupInput" message="api:getQuotaByCmdGroupInput"/><wsdl:output name="getQuotaByCmdGroupOutput" message="api:getQuotaByCmdGroupOutput"/><wsdl:fault name="getQuotaByCmdGroupFault" message="api:getQuotaByCmdGroupFault"/></wsdl:operation></wsdl:portType><wsdl:binding name="QuotaServiceBinding" type="api:QuotaServicePortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="getQuotaByServiceByMethod"><soap:operation soapAction="urn:QuotaService#getQuotaByServiceByMethod" style="rpc"/><wsdl:input name="getQuotaByServiceByMethodInput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:input><wsdl:output name="getQuotaByServiceByMethodOutput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:output><wsdl:fault name="getQuotaByServiceByMethodFault"><soap:fault use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="getQuotaByServiceByMethodFault"/></wsdl:fault></wsdl:operation><wsdl:operation name="getQuotaByCmdGroup"><soap:operation soapAction="urn:QuotaService#getQuotaByCmdGroup" style="rpc"/><wsdl:input name="getQuotaByCmdGroupInput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:input><wsdl:output name="getQuotaByCmdGroupOutput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:output><wsdl:fault name="getQuotaByCmdGroupFault"><soap:fault use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="getQuotaByCmdGroupFault"/></wsdl:fault></wsdl:operation></wsdl:binding><wsdl:service name="QuotaService"><wsdl:port name="QuotaServicePort" binding="api:QuotaServiceBinding"><soap:address location="https://api.yieldmanager.com/api-1.31/quota.php"/></wsdl:port></wsdl:service></wsdl:definitions>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0"?>
2
+ <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:api="https://api.yieldmanager.com/QuotaService" xmlns:types="https://api.yieldmanager.com/types" targetNamespace="https://api.yieldmanager.com/QuotaService"><wsdl:import namespace="https://api.yieldmanager.com/types" location="xsd_gen.php"/><wsdl:message name="getQuotaByServiceByMethodInput"><wsdl:part name="token" type="xsd:string"/><wsdl:part name="service_name" type="xsd:string"/><wsdl:part name="service_method" type="xsd:string"/></wsdl:message><wsdl:message name="getQuotaByCmdGroupInput"><wsdl:part name="token" type="xsd:string"/><wsdl:part name="cmdgroup_name" type="xsd:string"/></wsdl:message><wsdl:message name="getQuotaByServiceByMethodOutput"><wsdl:part name="quota" type="types:array_of_quota"/></wsdl:message><wsdl:message name="getQuotaByCmdGroupOutput"><wsdl:part name="quota" type="types:array_of_quota"/></wsdl:message><wsdl:message name="getQuotaByServiceByMethodFault"><wsdl:part name="detail" type="types:exception_detail"/></wsdl:message><wsdl:message name="getQuotaByCmdGroupFault"><wsdl:part name="detail" type="types:exception_detail"/></wsdl:message><wsdl:portType name="QuotaServicePortType"><wsdl:operation name="getQuotaByServiceByMethod"><wsdl:input name="getQuotaByServiceByMethodInput" message="api:getQuotaByServiceByMethodInput"/><wsdl:output name="getQuotaByServiceByMethodOutput" message="api:getQuotaByServiceByMethodOutput"/><wsdl:fault name="getQuotaByServiceByMethodFault" message="api:getQuotaByServiceByMethodFault"/></wsdl:operation><wsdl:operation name="getQuotaByCmdGroup"><wsdl:input name="getQuotaByCmdGroupInput" message="api:getQuotaByCmdGroupInput"/><wsdl:output name="getQuotaByCmdGroupOutput" message="api:getQuotaByCmdGroupOutput"/><wsdl:fault name="getQuotaByCmdGroupFault" message="api:getQuotaByCmdGroupFault"/></wsdl:operation></wsdl:portType><wsdl:binding name="QuotaServiceBinding" type="api:QuotaServicePortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="getQuotaByServiceByMethod"><soap:operation soapAction="urn:QuotaService#getQuotaByServiceByMethod" style="rpc"/><wsdl:input name="getQuotaByServiceByMethodInput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:input><wsdl:output name="getQuotaByServiceByMethodOutput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:output><wsdl:fault name="getQuotaByServiceByMethodFault"><soap:fault use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="getQuotaByServiceByMethodFault"/></wsdl:fault></wsdl:operation><wsdl:operation name="getQuotaByCmdGroup"><soap:operation soapAction="urn:QuotaService#getQuotaByCmdGroup" style="rpc"/><wsdl:input name="getQuotaByCmdGroupInput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:input><wsdl:output name="getQuotaByCmdGroupOutput"><soap:body use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:output><wsdl:fault name="getQuotaByCmdGroupFault"><soap:fault use="encoded" namespace="urn:QuotaService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="getQuotaByCmdGroupFault"/></wsdl:fault></wsdl:operation></wsdl:binding><wsdl:service name="QuotaService"><wsdl:port name="QuotaServicePort" binding="api:QuotaServiceBinding"><soap:address location="https://api-test.yieldmanager.com/api-1.31/quota.php"/></wsdl:port></wsdl:service></wsdl:definitions>
data/yieldmanager.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yieldmanager}
8
- s.version = "0.4.3"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Gathen"]
12
- s.date = %q{2010-04-21}
12
+ s.date = %q{2010-09-03}
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
14
  s.email = %q{bill@billgathen.com}
15
15
  s.extra_rdoc_files = [
@@ -88,6 +88,7 @@ Gem::Specification.new do |s|
88
88
  "wsdls/1.31/prod/notification.wsdl",
89
89
  "wsdls/1.31/prod/pixel.wsdl",
90
90
  "wsdls/1.31/prod/placement.wsdl",
91
+ "wsdls/1.31/prod/quota.wsdl",
91
92
  "wsdls/1.31/prod/report.wsdl",
92
93
  "wsdls/1.31/prod/search.wsdl",
93
94
  "wsdls/1.31/prod/section.wsdl",
@@ -106,6 +107,7 @@ Gem::Specification.new do |s|
106
107
  "wsdls/1.31/test/notification.wsdl",
107
108
  "wsdls/1.31/test/pixel.wsdl",
108
109
  "wsdls/1.31/test/placement.wsdl",
110
+ "wsdls/1.31/test/quota.wsdl",
109
111
  "wsdls/1.31/test/report.wsdl",
110
112
  "wsdls/1.31/test/search.wsdl",
111
113
  "wsdls/1.31/test/section.wsdl",
@@ -117,7 +119,7 @@ Gem::Specification.new do |s|
117
119
  s.homepage = %q{http://github.com/billgathen/yieldmanager}
118
120
  s.rdoc_options = ["--charset=UTF-8"]
119
121
  s.require_paths = ["lib"]
120
- s.rubygems_version = %q{1.3.5}
122
+ s.rubygems_version = %q{1.3.7}
121
123
  s.summary = %q{Interact with RightMedia's YieldManager API and Reportware products}
122
124
  s.test_files = [
123
125
  "spec/patch_detector_spec.rb",
@@ -131,7 +133,7 @@ Gem::Specification.new do |s|
131
133
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
132
134
  s.specification_version = 3
133
135
 
134
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
136
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
135
137
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
136
138
  s.add_runtime_dependency(%q<hpricot>, [">= 0.8.2"])
137
139
  else
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yieldmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Bill Gathen
@@ -9,29 +15,41 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-04-21 00:00:00 -04:00
18
+ date: 2010-09-03 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
23
34
  version: 1.2.9
24
- version:
35
+ type: :development
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: hpricot
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 59
46
+ segments:
47
+ - 0
48
+ - 8
49
+ - 2
33
50
  version: 0.8.2
34
- version:
51
+ type: :runtime
52
+ version_requirements: *id002
35
53
  description: This gem offers full access to YieldManager's API tools (read/write) as well as ad-hoc reporting through the Reportware tool
36
54
  email: bill@billgathen.com
37
55
  executables: []
@@ -113,6 +131,7 @@ files:
113
131
  - wsdls/1.31/prod/notification.wsdl
114
132
  - wsdls/1.31/prod/pixel.wsdl
115
133
  - wsdls/1.31/prod/placement.wsdl
134
+ - wsdls/1.31/prod/quota.wsdl
116
135
  - wsdls/1.31/prod/report.wsdl
117
136
  - wsdls/1.31/prod/search.wsdl
118
137
  - wsdls/1.31/prod/section.wsdl
@@ -131,6 +150,7 @@ files:
131
150
  - wsdls/1.31/test/notification.wsdl
132
151
  - wsdls/1.31/test/pixel.wsdl
133
152
  - wsdls/1.31/test/placement.wsdl
153
+ - wsdls/1.31/test/quota.wsdl
134
154
  - wsdls/1.31/test/report.wsdl
135
155
  - wsdls/1.31/test/search.wsdl
136
156
  - wsdls/1.31/test/section.wsdl
@@ -148,21 +168,27 @@ rdoc_options:
148
168
  require_paths:
149
169
  - lib
150
170
  required_ruby_version: !ruby/object:Gem::Requirement
171
+ none: false
151
172
  requirements:
152
173
  - - ">="
153
174
  - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
154
178
  version: "0"
155
- version:
156
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
+ none: false
157
181
  requirements:
158
182
  - - ">="
159
183
  - !ruby/object:Gem::Version
184
+ hash: 3
185
+ segments:
186
+ - 0
160
187
  version: "0"
161
- version:
162
188
  requirements: []
163
189
 
164
190
  rubyforge_project:
165
- rubygems_version: 1.3.5
191
+ rubygems_version: 1.3.7
166
192
  signing_key:
167
193
  specification_version: 3
168
194
  summary: Interact with RightMedia's YieldManager API and Reportware products