gangway 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gangway/call.rb +29 -0
- data/lib/gangway/session.rb +17 -0
- data/lib/gangway/subscriber.rb +21 -0
- data/lib/gangway/version.rb +3 -0
- data/lib/gangway.rb +7 -0
- metadata +65 -0
data/lib/gangway/call.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Gangway
|
2
|
+
module Call
|
3
|
+
include Session
|
4
|
+
|
5
|
+
def call(method, params)
|
6
|
+
res = session.call(method, message: {session_id: session_id}.merge(params))
|
7
|
+
return Hash.from_xml(res.body.values.first[:out])
|
8
|
+
end
|
9
|
+
|
10
|
+
def session
|
11
|
+
@session ||= new_session(:subscriber)
|
12
|
+
end
|
13
|
+
|
14
|
+
def session_id
|
15
|
+
@last_update ||= Time.now
|
16
|
+
if Time.now >= @last_update + 3600
|
17
|
+
@last_update = Time.now
|
18
|
+
@session_id = new_session_id
|
19
|
+
else
|
20
|
+
@session_id ||= new_session_id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def new_session_id
|
25
|
+
res = new_session(:session).call :login, message: {username: ENV['EWAY_USERNAME'], password: ENV['EWAY_PASSWORD']}
|
26
|
+
res.body[:login_response][:out]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'savon'
|
2
|
+
|
3
|
+
module Gangway
|
4
|
+
module Session
|
5
|
+
|
6
|
+
ENDPOINTS = {
|
7
|
+
session: 'https://soap.ixs1.net/1/Session?wsdl',
|
8
|
+
subscriber: 'https://soap.ixs1.net/1/Subscriber?wsdl'
|
9
|
+
}
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def new_session(wsdl)
|
14
|
+
Savon.client(wsdl: ENDPOINTS[wsdl])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Gangway
|
2
|
+
class Subscriber
|
3
|
+
extend Call
|
4
|
+
|
5
|
+
def self.add(params)
|
6
|
+
call(:add_subscriber, params)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.get(params)
|
10
|
+
call(:get_subscriber, params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.subscription_status(params)
|
14
|
+
call(:get_subscription_status, params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.change_email(params)
|
18
|
+
call(:change_email, params)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/gangway.rb
ADDED
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gangway
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- America's Test Kitchen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: savon
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.2.0
|
30
|
+
description: eWay SOAP wrapper
|
31
|
+
email:
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- lib/gangway/call.rb
|
37
|
+
- lib/gangway/session.rb
|
38
|
+
- lib/gangway/subscriber.rb
|
39
|
+
- lib/gangway/version.rb
|
40
|
+
- lib/gangway.rb
|
41
|
+
homepage:
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.8.24
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: eWay SOAP wrapper
|
65
|
+
test_files: []
|