exigo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +39 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +42 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/exigo.gemspec +67 -0
- data/lib/exigo.rb +30 -0
- data/test/creds.sample.rb +11 -0
- data/test/helper.rb +20 -0
- data/test/test_exigo.rb +19 -0
- metadata +137 -0
data/.document
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2-p180@exigo --create
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.6.0"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
end
|
14
|
+
|
15
|
+
gem "savon", ">= 0.9.2"
|
16
|
+
gem "curb"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (3.0.0)
|
5
|
+
curb (0.7.15)
|
6
|
+
git (1.2.5)
|
7
|
+
gyoku (0.4.3)
|
8
|
+
builder (>= 2.1.2)
|
9
|
+
httpi (0.9.3)
|
10
|
+
ntlm-http (>= 0.1.1)
|
11
|
+
rack
|
12
|
+
jeweler (1.6.0)
|
13
|
+
bundler (~> 1.0.0)
|
14
|
+
git (>= 1.2.5)
|
15
|
+
rake
|
16
|
+
nokogiri (1.4.4)
|
17
|
+
nori (0.2.0)
|
18
|
+
ntlm-http (0.1.1)
|
19
|
+
rack (1.2.2)
|
20
|
+
rake (0.8.7)
|
21
|
+
rcov (0.9.9)
|
22
|
+
savon (0.9.2)
|
23
|
+
builder (>= 2.1.2)
|
24
|
+
gyoku (>= 0.4.0)
|
25
|
+
httpi (>= 0.7.8)
|
26
|
+
nokogiri (>= 1.4.0)
|
27
|
+
nori (>= 0.2.0)
|
28
|
+
shoulda (2.11.3)
|
29
|
+
|
30
|
+
PLATFORMS
|
31
|
+
ruby
|
32
|
+
|
33
|
+
DEPENDENCIES
|
34
|
+
bundler (~> 1.0.0)
|
35
|
+
curb
|
36
|
+
jeweler (~> 1.6.0)
|
37
|
+
rcov
|
38
|
+
savon (>= 0.9.2)
|
39
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 David Moulton
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= Exigo
|
2
|
+
|
3
|
+
This is a small library to access the soap api at api.exigo.com.
|
4
|
+
|
5
|
+
The Exigo system is widely used by MLM marketing companies to manage users.
|
6
|
+
|
7
|
+
== Using Exigo
|
8
|
+
|
9
|
+
You must have a valid Exigo api username, password, and company to access the database.
|
10
|
+
|
11
|
+
Here's an example of the LoginCustomer api call:
|
12
|
+
|
13
|
+
begin
|
14
|
+
conn = Exigo.new(API_USERNAME,API_PASSWORD,API_COMPANY)
|
15
|
+
r1 = conn.login_customer(:LoginName=>username,:Password=>password)
|
16
|
+
r2 = conn.get_login_session(:SessionID=>r1[:session_id])
|
17
|
+
r2[:customer_id] # => exigo user id of the user if they authenticated
|
18
|
+
|
19
|
+
u = User.find_by_exigo_id(r2[:customer_id])
|
20
|
+
rescue # failed login will throw an exception
|
21
|
+
u = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
If you would like to run the tests, which run against production exigo, copy test/creds.sample.rb to test/creds.rb and modify the credentials to your info.
|
25
|
+
|
26
|
+
This is very new and relatively untested. Thus far it has only been tested against the LoginCustomer and GetCustomers api calls.
|
27
|
+
|
28
|
+
== Contributing to exigo
|
29
|
+
|
30
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
31
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
32
|
+
* Fork the project
|
33
|
+
* Start a feature/bugfix branch
|
34
|
+
* Commit and push until you are happy with your contribution
|
35
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
36
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
37
|
+
|
38
|
+
== Copyright
|
39
|
+
|
40
|
+
Copyright (c) 2011 David Moulton. See LICENSE.txt for
|
41
|
+
further details.
|
42
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "exigo"
|
18
|
+
gem.homepage = "http://github.com/dmoulton/exigo"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Access the Exigo API}
|
21
|
+
gem.description = %Q{provides access to exigo's API without 'very much' knowledge of soap}
|
22
|
+
gem.email = "dave@themoultons.net"
|
23
|
+
gem.authors = ["David Moulton"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "exigo #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/exigo.gemspec
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{exigo}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["David Moulton"]
|
12
|
+
s.date = %q{2011-05-12}
|
13
|
+
s.description = %q{provides access to exigo's API without 'very much' knowledge of soap}
|
14
|
+
s.email = %q{dave@themoultons.net}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rvmrc",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"exigo.gemspec",
|
29
|
+
"lib/exigo.rb",
|
30
|
+
"test/creds.sample.rb",
|
31
|
+
"test/helper.rb",
|
32
|
+
"test/test_exigo.rb"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/dmoulton/exigo}
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.6.0}
|
38
|
+
s.summary = %q{Access the Exigo API}
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
+
s.add_runtime_dependency(%q<savon>, [">= 0.9.2"])
|
45
|
+
s.add_runtime_dependency(%q<curb>, [">= 0"])
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
49
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<savon>, [">= 0.9.2"])
|
52
|
+
s.add_dependency(%q<curb>, [">= 0"])
|
53
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
56
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<savon>, [">= 0.9.2"])
|
60
|
+
s.add_dependency(%q<curb>, [">= 0"])
|
61
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
64
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
data/lib/exigo.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'savon'
|
2
|
+
|
3
|
+
class Exigo
|
4
|
+
attr_accessor :username,:password,:company,:wsdl,:namespacer
|
5
|
+
|
6
|
+
def initialize(username,password,company)
|
7
|
+
@username = username
|
8
|
+
@password = password
|
9
|
+
@company = company
|
10
|
+
@wsdl = "http://api.exigo.com/3.0/ExigoApi.asmx?WSDL"
|
11
|
+
@namespacer = "http://api.exigo.com/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def method_missing(name, *args, &block)
|
15
|
+
client = Savon::Client.new @wsdl
|
16
|
+
ns = @namespacer
|
17
|
+
auth = { "api:LoginName"=>@username, "api:Password"=>@password, "api:Company"=>@company }
|
18
|
+
payload = args[0].each_with_object({}) { |(k,v), h| h["api:#{k}"] = v }
|
19
|
+
action = name.to_s.camelcase
|
20
|
+
|
21
|
+
response = client.request "api:#{action}Request" do
|
22
|
+
http.headers["SOAPAction"] = "\"#{ns}#{action}\""
|
23
|
+
soap.namespaces["xmlns:env"] = "http://schemas.xmlsoap.org/soap/envelope/"
|
24
|
+
soap.namespaces["xmlns:api"] = ns
|
25
|
+
soap.header = { "api:ApiAuthentication" => auth }
|
26
|
+
soap.body = payload
|
27
|
+
end
|
28
|
+
response.to_hash["#{name}_result".to_sym]
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Test::Unit::TestCase
|
2
|
+
# A valid API user for logging into api.exigo.com
|
3
|
+
API_USERNAME = 'username'
|
4
|
+
API_PASSWORD = 'password'
|
5
|
+
API_COMPANY = 'company'
|
6
|
+
|
7
|
+
# A valid user in exigo that the api user has access to
|
8
|
+
EXIGO_USERNAME = 'username'
|
9
|
+
EXIGO_PASSWORD = 'password'
|
10
|
+
EXIGO_ID = 123
|
11
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'creds'
|
4
|
+
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'test/unit'
|
13
|
+
require 'shoulda'
|
14
|
+
|
15
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
16
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
17
|
+
require 'exigo'
|
18
|
+
|
19
|
+
class Test::Unit::TestCase
|
20
|
+
end
|
data/test/test_exigo.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestExigo < Test::Unit::TestCase
|
4
|
+
should "get customer info" do
|
5
|
+
x = Exigo.new(API_USERNAME,API_PASSWORD,API_COMPANY)
|
6
|
+
res = x.get_customers(:CustomerID => EXIGO_ID)
|
7
|
+
assert res[:result][:status] == "Success"
|
8
|
+
end
|
9
|
+
|
10
|
+
should "log in a user" do
|
11
|
+
conn = Exigo.new(API_USERNAME,API_PASSWORD,API_COMPANY)
|
12
|
+
res = conn.login_customer(:LoginName=>EXIGO_USERNAME,:Password=>EXIGO_PASSWORD)
|
13
|
+
assert res[:result][:status] == "Success"
|
14
|
+
|
15
|
+
res = conn.get_login_session(:SessionID=>res[:session_id])
|
16
|
+
assert res[:result][:status] == "Success"
|
17
|
+
assert_equal EXIGO_ID.to_s, res[:customer_id]
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exigo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David Moulton
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-12 00:00:00 -06:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: savon
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.2
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: curb
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: shoulda
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: bundler
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.0.0
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: jeweler
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.6.0
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rcov
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
description: provides access to exigo's API without 'very much' knowledge of soap
|
83
|
+
email: dave@themoultons.net
|
84
|
+
executables: []
|
85
|
+
|
86
|
+
extensions: []
|
87
|
+
|
88
|
+
extra_rdoc_files:
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.rdoc
|
91
|
+
files:
|
92
|
+
- .document
|
93
|
+
- .rvmrc
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.rdoc
|
98
|
+
- Rakefile
|
99
|
+
- VERSION
|
100
|
+
- exigo.gemspec
|
101
|
+
- lib/exigo.rb
|
102
|
+
- test/creds.sample.rb
|
103
|
+
- test/helper.rb
|
104
|
+
- test/test_exigo.rb
|
105
|
+
has_rdoc: true
|
106
|
+
homepage: http://github.com/dmoulton/exigo
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: -4349311301346426398
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
version: "0"
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: "0"
|
129
|
+
requirements: []
|
130
|
+
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 1.6.0
|
133
|
+
signing_key:
|
134
|
+
specification_version: 3
|
135
|
+
summary: Access the Exigo API
|
136
|
+
test_files: []
|
137
|
+
|