projector_pws 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/projector_pws/legacy.rb +63 -0
- data/lib/projector_pws/version.rb +1 -1
- data/lib/projector_pws.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b0bcee7be8c8664e8c514bac9f29ceb5d6dfcb
|
4
|
+
data.tar.gz: 4deb3b91eab459ea84f5ca92fc7b2f1a9f2cec3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24c2720c4a08ce03a1da65214ed366cbb8e92e0d84f2506f6bf5a221b8be197cfa96a6d1ce9d35e7ca166eceac4bf97442c483ff8302ba70fc20958da8f229af
|
7
|
+
data.tar.gz: 0afcbc4300873378a498239f091a9db588bc44fe156b3beae05651df9978fea439de408220eec6986e1eea9bbd5d0af6863547155b8549432dfc6ad912b1538e
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# ProjectorPWS
|
2
|
+
# by Eresse <eresse@eresse.net>
|
3
|
+
|
4
|
+
# External Includes
|
5
|
+
require 'savon'
|
6
|
+
require 'aromat'
|
7
|
+
|
8
|
+
# Internal Includes
|
9
|
+
require 'projector_pws/version'
|
10
|
+
|
11
|
+
# ProjectorPWS Module:
|
12
|
+
# Root Module for ProjectorPWS.
|
13
|
+
module ProjectorPWS
|
14
|
+
|
15
|
+
# Legacy Module:
|
16
|
+
# Provides access to Legacy Web Services
|
17
|
+
module Legacy
|
18
|
+
|
19
|
+
# Service Definition
|
20
|
+
WSDL = 'https://secure.projectorpsa.com/OpsProjectorWebSvc/OpsProjectorSvc.asmx?wsdl'
|
21
|
+
|
22
|
+
# URL Path
|
23
|
+
URL_PATH = 'OpsProjectorWebSvc/OpsProjectorSvc.asmx'
|
24
|
+
|
25
|
+
# Base URL
|
26
|
+
BASE_URL = 'https://secure.projectorpsa.com'
|
27
|
+
|
28
|
+
# Open Client
|
29
|
+
def self.open url = BASE_URL
|
30
|
+
c = Savon.client soap_version: 2, wsdl: WSDL, endpoint: service_url(url), env_namespace: :soap
|
31
|
+
return yield c if block_given?
|
32
|
+
c
|
33
|
+
end
|
34
|
+
|
35
|
+
# Pass with Authenticate
|
36
|
+
def self.with_auth username, password, account_code = nil, url = BASE_URL
|
37
|
+
|
38
|
+
# Prepare Creds
|
39
|
+
creds = {}
|
40
|
+
creds['tns:AccountName'] = account_code if account_code
|
41
|
+
creds['tns:EmailAddress'] = username
|
42
|
+
creds['tns:Password'] = password
|
43
|
+
|
44
|
+
# Open API
|
45
|
+
open(url) { |c| yield c, { message: {}, soap_header: { 'tns:OpsAuthenticationHeader' => creds } } }
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get URL for Account
|
49
|
+
def self.get_url username, password, account_code = nil
|
50
|
+
with_auth(username, password, account_code) { |c, params| c.call(:get_web_service_url, params).body[:get_web_service_url_response][:get_web_service_url_result][:web_service_url] }
|
51
|
+
end
|
52
|
+
|
53
|
+
# Export Resources
|
54
|
+
def self.export_resources url, username, password, account_code = nil
|
55
|
+
with_auth(username, password, account_code, url) { |c, params| c.call(:export_resources, params.merge(message: { request: { 'Parameters' => {} } })).body[:export_resources_response][:export_resources_result][:data][:resources][:resource] }
|
56
|
+
end
|
57
|
+
|
58
|
+
# Generate Service URL
|
59
|
+
def self.service_url base_url
|
60
|
+
"#{base_url}/#{URL_PATH}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/projector_pws.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: projector_pws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eresse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
95
95
|
- lib/projector_pws.rb
|
96
|
+
- lib/projector_pws/legacy.rb
|
96
97
|
- lib/projector_pws/version.rb
|
97
98
|
- projector_pws.gemspec
|
98
99
|
homepage: http://redmine.eresse.net/projects/projector_pws
|