yieldmanager 0.4.0 → 0.4.1
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/README.rdoc +4 -2
- data/VERSION +1 -1
- data/lib/yieldmanager/client.rb +14 -5
- data/spec/yieldmanager/client_spec.rb +16 -3
- data/yieldmanager.gemspec +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= yieldmanager
|
2
2
|
|
3
|
-
This gem offers
|
4
|
-
|
3
|
+
This gem offers read/write access to YieldManager's API tools and
|
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
|
@@ -41,6 +41,8 @@ To access the test environment, use this:
|
|
41
41
|
:env => "test"
|
42
42
|
)
|
43
43
|
|
44
|
+
The keys can also be passed as string: 'user', 'pass', 'api_version' and 'env'.
|
45
|
+
|
44
46
|
*NOTE* Changing the environment after creation has no effect!
|
45
47
|
|
46
48
|
=== Finding available services
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/yieldmanager/client.rb
CHANGED
@@ -42,13 +42,22 @@ module Yieldmanager
|
|
42
42
|
# * :api_version (required) - Yieldmanager API version (i.e., "1.30")
|
43
43
|
# * :env (optional) - Yieldmanager environment "prod" or "test" (defaults to prod)
|
44
44
|
def initialize(options = nil)
|
45
|
-
unless options &&
|
45
|
+
unless options &&
|
46
|
+
(options[:user] || options['user']) &&
|
47
|
+
(options[:pass] || options['pass']) &&
|
48
|
+
(options[:api_version] || options['api_version'])
|
46
49
|
raise ArgumentError, ":user, :pass and :api_version are required"
|
47
50
|
end
|
48
|
-
@user = options[:user]
|
49
|
-
@pass = options[:pass]
|
50
|
-
@api_version = options[:api_version]
|
51
|
-
|
51
|
+
@user = options[:user] ||= options['user']
|
52
|
+
@pass = options[:pass] ||= options['pass']
|
53
|
+
@api_version = options[:api_version] ||= options['api_version']
|
54
|
+
if options[:env]
|
55
|
+
@env = options[:env]
|
56
|
+
elsif options['env']
|
57
|
+
@env = options['env']
|
58
|
+
else
|
59
|
+
@env = "prod"
|
60
|
+
end
|
52
61
|
@wsdl_dir = "#{WSDL_DIR}/#{@api_version}/#{@env}"
|
53
62
|
wrap_services
|
54
63
|
end
|
@@ -13,19 +13,32 @@ describe "A new Yieldmanager client" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "requires :user, :pass and :api_version as args" do
|
16
|
-
@ym.user.should
|
17
|
-
@ym.pass.should
|
18
|
-
@ym.api_version.should
|
16
|
+
@ym.user.should == login_args[:user]
|
17
|
+
@ym.pass.should == login_args[:pass]
|
18
|
+
@ym.api_version.should == login_args[:api_version]
|
19
19
|
lambda { Yieldmanager::Client.new() }.should raise_error(ArgumentError)
|
20
20
|
lambda { Yieldmanager::Client.new({}) }.should raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
|
23
|
+
it "accepts 'user', 'pass' and 'api_version' as args" do
|
24
|
+
ym = Yieldmanager::Client.new(
|
25
|
+
'user' => ENV['YIELDMANAGER_USER'],
|
26
|
+
'pass' => ENV['YIELDMANAGER_PASS'],
|
27
|
+
'api_version' => ENV['YIELDMANAGER_API_VERSION'])
|
28
|
+
ym.user.should == ENV['YIELDMANAGER_USER']
|
29
|
+
ym.pass.should == ENV['YIELDMANAGER_PASS']
|
30
|
+
ym.api_version.should == ENV['YIELDMANAGER_API_VERSION']
|
31
|
+
end
|
32
|
+
|
23
33
|
it "defaults to prod, accepts override to test" do
|
24
34
|
@ym.env.should == "prod"
|
25
35
|
@ym.contact.inspect.should match("api.yieldmanager.com")
|
26
36
|
ym_test = Yieldmanager::Client.new(login_args.merge(:env => "test"))
|
27
37
|
ym_test.env.should == "test"
|
28
38
|
ym_test.contact.inspect.should match("api-test.yieldmanager.com")
|
39
|
+
ym_test2 = Yieldmanager::Client.new(login_args.merge('env' => "test"))
|
40
|
+
ym_test2.env.should == "test"
|
41
|
+
ym_test2.contact.inspect.should match("api-test.yieldmanager.com")
|
29
42
|
end
|
30
43
|
|
31
44
|
it "displays available services" do
|
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.
|
8
|
+
s.version = "0.4.1"
|
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-01-
|
12
|
+
s.date = %q{2010-01-12}
|
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 = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yieldmanager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill Gathen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-12 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|