yieldmanager 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.md} +46 -39
- data/VERSION +1 -1
- data/lib/soap4r_19_patch/soap/property.rb +12 -12
- data/yieldmanager.gemspec +4 -4
- metadata +4 -4
data/{README.rdoc → README.md}
RENAMED
@@ -1,29 +1,33 @@
|
|
1
|
-
|
1
|
+
# yieldmanager
|
2
2
|
|
3
|
-
This gem offers read/write access to YieldManager's API tools and
|
3
|
+
This gem offers read/write access to [YieldManager's API tools](https://api.yieldmanager.com/doc/) and
|
4
4
|
ad-hoc reporting through the Reportware tool.
|
5
5
|
|
6
6
|
Currently it generates a fresh wsdl from the api.yieldmanager.com site the
|
7
7
|
first time you use a service (in the future it will use locally-cached
|
8
8
|
copies) and re-uses that wsdl for the life of the Yieldmanager::Client object.
|
9
9
|
|
10
|
-
This version implements API version 1.33
|
10
|
+
This version implements API version 1.33.
|
11
11
|
|
12
|
-
|
12
|
+
### Installation
|
13
13
|
|
14
|
-
Yieldmanager is available as a gem
|
14
|
+
Yieldmanager is available as a gem for easy installation.
|
15
15
|
|
16
16
|
sudo gem install yieldmanager
|
17
17
|
|
18
|
-
|
18
|
+
or if you're using [RVM](https://rvm.beginrescueend.com/) (and why on earth wouldn't you?)
|
19
19
|
|
20
|
+
gem install yieldmanager
|
21
|
+
|
22
|
+
The project is available for review/forking on github.com
|
23
|
+
|
20
24
|
git clone git://github.com/billgathen/yieldmanager.git
|
21
25
|
|
22
26
|
To use in a Rails project, add this to config/environment.rb:
|
23
27
|
|
24
28
|
config.gem 'yieldmanager'
|
25
29
|
|
26
|
-
|
30
|
+
### Creating a Yieldmanager::Client
|
27
31
|
|
28
32
|
require 'yieldmanager'
|
29
33
|
|
@@ -41,36 +45,38 @@ To access the test environment, use this:
|
|
41
45
|
:env => "test"
|
42
46
|
)
|
43
47
|
|
44
|
-
The keys can also be passed as
|
48
|
+
The keys can also be passed as strings: 'user', 'pass' and 'env'.
|
45
49
|
|
46
|
-
|
50
|
+
**NOTE** Changing the environment after creation has no effect!
|
47
51
|
|
48
|
-
|
52
|
+
### What API version am I using?
|
49
53
|
|
50
54
|
To check (or log) the current API version, execute the following:
|
51
55
|
|
52
|
-
|
56
|
+
Yieldmanager::Client.api_version
|
53
57
|
|
54
|
-
|
58
|
+
### Finding available services
|
55
59
|
|
56
60
|
@ym.available_services
|
57
61
|
|
58
|
-
|
62
|
+
### Using a service
|
59
63
|
|
60
64
|
@ym.session do |token|
|
61
65
|
@currencies = @ym.dictionary.getCurrencies(token)
|
62
66
|
end
|
63
67
|
|
64
|
-
|
68
|
+
**GOTCHA** In projects with ActiveRecord enabled (i.e., Rails projects)
|
65
69
|
SOAP will identify returned data as AR objects if there's a
|
66
70
|
naming collision. For example, if you're running
|
71
|
+
|
67
72
|
@ym.creative.get(token,123)
|
68
|
-
|
73
|
+
|
74
|
+
and you have an AR objects for a **creatives** table in the db, the
|
69
75
|
SOAP parser will interpret the returned SOAP object as
|
70
76
|
an AR Creative object, resulting in bizarre errors. Uniquely
|
71
77
|
re-name your AR object to eliminate the conflict.
|
72
78
|
|
73
|
-
|
79
|
+
### Pagination
|
74
80
|
|
75
81
|
Some calls return datasets too large to retrieve all at once.
|
76
82
|
Pagination allows you to pull them back incrementally, handling
|
@@ -87,12 +93,12 @@ the partial dataset on-the-fly or accumulating it for later use.
|
|
87
93
|
end
|
88
94
|
|
89
95
|
|
90
|
-
|
96
|
+
### Pulling reports
|
91
97
|
|
92
98
|
Accessing reportware assumes you've used the "Get request XML"
|
93
99
|
functionality in the UI to get your request XML, or have
|
94
100
|
crafted one from scratch. Assuming it's in a variable called
|
95
|
-
|
101
|
+
**request_xml**, you'd access the data this way:
|
96
102
|
|
97
103
|
@ym.session do |token|
|
98
104
|
report = @ym.pull_report(token, request_xml)
|
@@ -109,59 +115,60 @@ Column data can be accessed either by index or column name:
|
|
109
115
|
report.data[0].by_name('advertiser_name') # => "Bob's Ads"
|
110
116
|
report.data[0].by_name(:advertiser_name) # => "Bob's Ads"
|
111
117
|
|
112
|
-
If you call
|
113
|
-
|
118
|
+
If you call **by_name** with a non-existent column, it will throw an
|
119
|
+
**ArgumentError** telling you so.
|
114
120
|
|
115
121
|
Or you can extract the report to an array of named hashes, removing
|
116
122
|
dependencies on the gem for consumers of the data (say, across an API):
|
117
123
|
|
118
|
-
|
119
|
-
|
124
|
+
hashes = report.to_hashes
|
125
|
+
hashes[0]['advertiser_name'] # => "Bob's Ads"
|
120
126
|
|
121
|
-
|
127
|
+
**NOTE** Any totals columns your xml requests will be interpreted
|
122
128
|
as ordinary data.
|
123
129
|
|
124
|
-
|
130
|
+
### Mocking reports
|
125
131
|
|
126
132
|
When simulating report calls without actually hitting Yieldmanager, you can
|
127
133
|
create your own reports.
|
128
134
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
135
|
+
rpt = Yieldmanager::Report.new
|
136
|
+
rpt.headers = ["first","second"]
|
137
|
+
rpt.add_row([1,2])
|
138
|
+
rpt.data.first.by_name("first").should == 1
|
139
|
+
rpt.data.first.by_name("second").should == 2
|
134
140
|
|
135
|
-
|
141
|
+
### session vs. start_session/end_session
|
136
142
|
|
137
|
-
The
|
143
|
+
The **session** method opens a session, gives you a token to use in your service
|
138
144
|
calls, then closes the session when the block ends, even if an exception is
|
139
145
|
raised during processing. It's the recommended method to ensure you don't
|
140
146
|
hang connections when things go wrong. If you use start/end, make sure you
|
141
147
|
wrap your logic in a begin/ensure clause and call end_session from the ensure.
|
142
148
|
|
143
|
-
|
149
|
+
## RE: Ruby 1.9
|
144
150
|
|
145
151
|
In an effort to be a good ruby citizen, KarateCode and I have made the gem
|
146
|
-
1.9 compatible, but it is based on soap4r 1.5.8, which
|
147
|
-
|
148
|
-
|
152
|
+
1.9 compatible, but it is based on soap4r 1.5.8, which requires a pile of monkey-patches
|
153
|
+
to get working and not **every** combination of calls and args have been tested
|
154
|
+
in 1.9. If you're interested in what's been done, check out **lib/soap4r_19_patch**
|
155
|
+
and [Tomor Doron's blog post](http://tomerdoron.blogspot.com/2009/10/fixing-soap4r-for-ruby-19.html).
|
149
156
|
|
150
|
-
|
157
|
+
## Note on Patches/Pull Requests
|
151
158
|
|
152
159
|
* Fork the project.
|
153
160
|
* Make your feature addition or bug fix.
|
154
|
-
* Add
|
161
|
+
* Add specs for it. This is important so I don't break it in a
|
155
162
|
future version unintentionally.
|
156
163
|
* Commit, do not mess with rakefile, version, or history.
|
157
164
|
(if you want to have your own version, that is fine but
|
158
165
|
bump version in a commit by itself I can ignore when I pull)
|
159
166
|
* Send me a pull request. Bonus points for topic branches.
|
160
167
|
|
161
|
-
|
168
|
+
## Thanks for contributing!
|
162
169
|
* manlycode[https://github.com/manlycode] (Chris Rittersdorf)
|
163
170
|
* KarateCode[https://github.com/KarateCode] (Michael Schneider)
|
164
171
|
|
165
|
-
|
172
|
+
## Copyright
|
166
173
|
|
167
174
|
Copyright (c) 2009-2011 Bill Gathen. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
@@ -325,16 +325,16 @@ end
|
|
325
325
|
end
|
326
326
|
|
327
327
|
|
328
|
-
|
329
|
-
unless Enumerable.instance_methods.include?('inject')
|
330
|
-
module Enumerable
|
331
|
-
def inject(init)
|
332
|
-
result = init
|
333
|
-
each do |item|
|
334
|
-
result = yield(result, item)
|
335
|
-
end
|
336
|
-
result
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
328
|
+
## for ruby/1.6.
|
329
|
+
#unless Enumerable.instance_methods.include?('inject')
|
330
|
+
# module Enumerable
|
331
|
+
# def inject(init)
|
332
|
+
# result = init
|
333
|
+
# each do |item|
|
334
|
+
# result = yield(result, item)
|
335
|
+
# end
|
336
|
+
# result
|
337
|
+
# end
|
338
|
+
# end
|
339
|
+
#end
|
340
340
|
|
data/yieldmanager.gemspec
CHANGED
@@ -5,16 +5,16 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{yieldmanager}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.5"
|
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{2011-
|
12
|
+
s.date = %q{2011-08-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 = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.
|
17
|
+
"README.md",
|
18
18
|
"TODO"
|
19
19
|
]
|
20
20
|
s.files = [
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
".rspec",
|
24
24
|
"API_VERSION",
|
25
25
|
"LICENSE",
|
26
|
-
"README.
|
26
|
+
"README.md",
|
27
27
|
"Rakefile",
|
28
28
|
"TODO",
|
29
29
|
"VERSION",
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: yieldmanager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bill Gathen
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-03 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -42,7 +42,7 @@ extensions: []
|
|
42
42
|
|
43
43
|
extra_rdoc_files:
|
44
44
|
- LICENSE
|
45
|
-
- README.
|
45
|
+
- README.md
|
46
46
|
- TODO
|
47
47
|
files:
|
48
48
|
- .document
|
@@ -50,7 +50,7 @@ files:
|
|
50
50
|
- .rspec
|
51
51
|
- API_VERSION
|
52
52
|
- LICENSE
|
53
|
-
- README.
|
53
|
+
- README.md
|
54
54
|
- Rakefile
|
55
55
|
- TODO
|
56
56
|
- VERSION
|