aria_sdk 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ require 'aria_sdk/aria_rest_client'
2
+
3
+ class AriaAdmintoolsRestClient < AriaRestClient
4
+
5
+ attr_reader :prod
6
+
7
+ def initialize client_no, auth_key, prod = false
8
+ @prod = prod
9
+
10
+ url = if prod
11
+ 'https://admintools.ariasystems.net/AdminTools.php/Dispatcher'
12
+ else
13
+ 'https://admintools.future.stage.ariasystems.net/AdminTools.php/Dispatcher'
14
+ end
15
+
16
+ super client_no, auth_key, url
17
+ end
18
+
19
+ end
@@ -0,0 +1,19 @@
1
+ require 'aria_sdk/aria_rest_client'
2
+
3
+ class AriaCoreRestClient < AriaRestClient
4
+
5
+ attr_reader :prod
6
+
7
+ def initialize client_no, auth_key, prod = false
8
+ @prod = prod
9
+
10
+ url = if prod
11
+ 'https://secure.ariasystems.net/api/ws/api_ws_class_dispatcher.php'
12
+ else
13
+ 'https://secure.future.stage.ariasystems.net/api/ws/api_ws_class_dispatcher.php'
14
+ end
15
+
16
+ super client_no, auth_key, url
17
+ end
18
+
19
+ end
@@ -0,0 +1,41 @@
1
+ require 'savon'
2
+
3
+ class AriaCoreSoapClient
4
+ include Savon
5
+
6
+ attr_accessor :client_no, :auth_key
7
+
8
+ def initialize(client_no, auth_key, version, prod = false)
9
+ self.client_no = client_no
10
+ self.auth_key = auth_key
11
+
12
+ wsdl = if prod
13
+ "https://secure.ariasystems.net/api/Advanced/wsdl/#{version}/complete-doc_literal_wrapped.wsdl"
14
+ else
15
+ "https://secure.future.stage.ariasystems.net/api/Advanced/wsdl/#{version}/complete-doc_literal_wrapped.wsdl"
16
+ end
17
+
18
+ @client = Savon.client(wsdl: wsdl)
19
+ @client.operations
20
+ end
21
+
22
+ def call(api_name, message = {})
23
+
24
+ defaults = {
25
+ output_format: 'json',
26
+ client_no: self.client_no,
27
+ auth_key: self.auth_key,
28
+ }
29
+
30
+ message.merge!(defaults)
31
+
32
+ response = @client.call(api_name.to_sym, message: message )
33
+ response_name = api_name << '_response_element'
34
+
35
+ body = response.body[response_name.to_sym]
36
+
37
+ raise body[:error_msg] unless body[:error_code] == 0
38
+ return body
39
+ end
40
+
41
+ end
@@ -0,0 +1,19 @@
1
+ require 'aria_sdk/aria_rest_client'
2
+
3
+ class AriaObjectQueryRestClient < AriaRestClient
4
+
5
+ attr_reader :prod
6
+
7
+ def initialize client_no, auth_key, prod = false
8
+ @prod = prod
9
+
10
+ url = if prod
11
+ 'https://secure.ariasystems.net/api/AriaQuery/objects.php'
12
+ else
13
+ 'https://secure.future.stage.ariasystems.net/api/AriaQuery/objects.php'
14
+ end
15
+
16
+ super client_no, auth_key, url
17
+ end
18
+
19
+ end
@@ -0,0 +1,32 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ class AriaRestClient
5
+ include HTTParty
6
+
7
+ attr_accessor :client_no, :auth_key, :url
8
+
9
+ def initialize(client_no, auth_key, url)
10
+ self.client_no = client_no
11
+ self.auth_key = auth_key
12
+ self.url = url
13
+ end
14
+
15
+ def call(api_name, options = {})
16
+
17
+ defaults = {
18
+ :output_format => 'json',
19
+ :client_no => self.client_no,
20
+ :auth_key => self.auth_key,
21
+ :rest_call => api_name
22
+ }
23
+
24
+ options.merge!(defaults)
25
+
26
+ result = self.class.post(self.url, :body => options)
27
+
28
+ raise result["error_msg"] unless result["error_code"] == 0
29
+ return result
30
+ end
31
+
32
+ end
data/lib/aria_sdk.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'aria_sdk/aria_rest_client'
2
+ require 'aria_sdk/aria_core_rest_client'
3
+ require 'aria_sdk/aria_admintools_rest_client'
4
+ require 'aria_sdk/aria_object_query_rest_client'
5
+ require 'aria_sdk/aria_core_soap_client'
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aria_sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Aria Systems, Inc.
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-04-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '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: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: savon
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: json
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: A set of objects to help connect with the Aria Systems REST and SOAP
79
+ Core, Object Query, and Admintools APIs.
80
+ email: support@ariasystems.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - lib/aria_sdk/aria_core_soap_client.rb
86
+ - lib/aria_sdk/aria_object_query_rest_client.rb
87
+ - lib/aria_sdk/aria_admintools_rest_client.rb
88
+ - lib/aria_sdk/aria_rest_client.rb
89
+ - lib/aria_sdk/aria_core_rest_client.rb
90
+ - lib/aria_sdk.rb
91
+ homepage: https://developer.ariasystems.net/
92
+ licenses: []
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 1.8.23
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: A wrapper for the Aria Systems REST and SOAP APIs
115
+ test_files: []