aria_sdk_unofficial 1.0.0
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +97 -0
- data/Rakefile +8 -0
- data/aria_sdk_unofficial.gemspec +23 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/aria_sdk_unofficial.rb +54 -0
- data/lib/aria_sdk_unofficial/version.rb +3 -0
- data/tasks/rspec.rake +3 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e454fb1fa17335eac9885753778b4ce1eb2eef85
|
4
|
+
data.tar.gz: 7170aa70f4d0c1597318330d4b41feadd60de532
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e2da8af2ee543b95c74de07f34386c304af9f5d1d69352e4cc5bdea7287e081c637a1b5896602513af129a2e8be2c7287c1257347d21723210f615526351c05
|
7
|
+
data.tar.gz: d2514e028e06abbf484a8bf697bd6bd1420be75539dcd2acfd50212065a8a44849e692cff23a928b43be8a82cfec6f5aef0bb584e890e4facb7d5e9772a3602b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# AriaSdkUnofficial
|
2
|
+
|
3
|
+
This is an unofficial Aria SDK gem meant to be a bit simpler while also implementing all of the end points instead of a limited number of them.
|
4
|
+
This product is issued with no warranty and is in no way any representation of Aria Systems.
|
5
|
+
|
6
|
+
The official sdk can be found [here](https://github.com/AriaSystems/ruby_sdk).
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'aria_sdk_unofficial'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install aria_sdk_unofficial
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
To use this gem, instantiate the Aria object and use the call method to make an API call.
|
26
|
+
|
27
|
+
To instaniate the Aria object, a dictionary with the following keys is passed in as the only argument:
|
28
|
+
```ruby
|
29
|
+
{
|
30
|
+
client_no: 123456,
|
31
|
+
auth_key:'auth_key_here',
|
32
|
+
api_type: 0,
|
33
|
+
env_type: 1
|
34
|
+
}
|
35
|
+
```
|
36
|
+
### Valid api types are as follows:
|
37
|
+
* 0 = Core API
|
38
|
+
* 1 = Object Query API
|
39
|
+
* 2 = Admintools API
|
40
|
+
|
41
|
+
### Valid environment types are as follows:
|
42
|
+
* 0 = Stage Future
|
43
|
+
* 1 = Stage Current
|
44
|
+
* 2 = Production
|
45
|
+
* 3 = Stage Future CPH
|
46
|
+
* 4 = Production CPH
|
47
|
+
|
48
|
+
**Note:** One optional parameter can be assed in named api_name. This will be ignored, but is allowed.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
aria = Aria.new({client_no: 123456, auth_key:'nfjhfruiebire', api_type: 0, env_type: 0})
|
52
|
+
```
|
53
|
+
After instantiating the object, the client_no, auth_key, and url are all accessible
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
puts aria.url
|
57
|
+
```
|
58
|
+
|
59
|
+
### To make and API call, use the call method with the following parameters:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
{
|
63
|
+
api_name: set_session,
|
64
|
+
options: {acct_no: 123456},
|
65
|
+
remove_nil: true
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
options and remove_nil are both optional parameters.
|
70
|
+
|
71
|
+
Options are the additional API parameters used.
|
72
|
+
|
73
|
+
Removing nill will strip parameters with nil values from the options prior to sending to Aria.
|
74
|
+
|
75
|
+
**Defaults:** remove_nil=false, options = {}
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
aria = Aria.new({client_no: 123456, auth_key:'nfjhfruiebire', api_type: 0, env_type: 0})
|
79
|
+
response = aria.call('authenticate_caller', {acct_no: 123456})
|
80
|
+
puts response.['session_id']
|
81
|
+
```
|
82
|
+
|
83
|
+
### Admintools example
|
84
|
+
```ruby
|
85
|
+
aria = Aria.new({client_no: 123456, auth_key:'nfjhfruiebire', api_type: 2, env_type: 0})
|
86
|
+
if response['error_code'] == 0
|
87
|
+
response['coa_list'].each do |coa|
|
88
|
+
puts "coa id #{coa['coa_id']}"
|
89
|
+
puts "coa code #{coa['coa_code']}"
|
90
|
+
puts "coa description #{coa['coa_description']}"
|
91
|
+
end
|
92
|
+
else
|
93
|
+
puts "API call failed, error code #{response['error_msg']}"
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
#### The response element is an [httparty](https://github.com/jnunemaker/httparty) response.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aria_sdk_unofficial/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "aria_sdk_unofficial"
|
8
|
+
spec.version = AriaSdkUnofficial::VERSION
|
9
|
+
spec.authors = ["Austin Turner"]
|
10
|
+
spec.email = ["paustint@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Aria REST SDK based on the official Aria SDK located here: https://github.com/AriaSystems/ruby_sdk"
|
13
|
+
spec.description = "Wrapper to connect to the Aria API's in an easy to use manner"
|
14
|
+
spec.homepage = "https://github.com/paustint/aria_sdk_unofficial"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_dependency "httparty", "~> 0.13"
|
20
|
+
spec.add_dependency "json", "~> 1.8"
|
21
|
+
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "aria_sdk_unofficial"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require "aria_sdk_unofficial/version"
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
class Aria
|
6
|
+
|
7
|
+
attr_accessor :client_no, :auth_key, :url
|
8
|
+
|
9
|
+
def initialize(client_no:, auth_key:, api_type:, env_type:, api_name: nil)
|
10
|
+
self.client_no = client_no
|
11
|
+
self.auth_key = auth_key
|
12
|
+
self.url = get_url api_type, env_type
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(api_name, options = {}, remove_nil=false)
|
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
|
+
if remove_nil
|
25
|
+
options.keys.each { |x| options.delete x if options[x].nil? }
|
26
|
+
end
|
27
|
+
|
28
|
+
options.merge!(defaults)
|
29
|
+
HTTParty.post(self.url, :body => options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_url(api_type, env_type)
|
33
|
+
env_url = ''
|
34
|
+
full_url = ''
|
35
|
+
if env_type == 0 # SF
|
36
|
+
env_url += '.future.stage'
|
37
|
+
elsif env_type == 1 # SC
|
38
|
+
env_url += '.current.stage'
|
39
|
+
elsif env_type == 3 # SF CPH
|
40
|
+
env_url += '.future.stage.cph'
|
41
|
+
elsif env_type == 4 # Prod CPH
|
42
|
+
env_url = '.cph'
|
43
|
+
end
|
44
|
+
|
45
|
+
if api_type == 0 # core
|
46
|
+
full_url = "https://secure#{env_url}.ariasystems.net/api/ws/api_ws_class_dispatcher.php"
|
47
|
+
elsif api_type == 1 # object
|
48
|
+
full_url = "https://secure#{env_url}.ariasystems.net/api/AriaQuery/objects.php"
|
49
|
+
else # admin
|
50
|
+
full_url = "https://admintools#{env_url}.ariasystems.net/AdminTools.php/Dispatcher"
|
51
|
+
end
|
52
|
+
return full_url
|
53
|
+
end
|
54
|
+
end
|
data/tasks/rspec.rake
ADDED
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aria_sdk_unofficial
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Austin Turner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Wrapper to connect to the Aria API's in an easy to use manner
|
56
|
+
email:
|
57
|
+
- paustint@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- aria_sdk_unofficial.gemspec
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/aria_sdk_unofficial.rb
|
72
|
+
- lib/aria_sdk_unofficial/version.rb
|
73
|
+
- tasks/rspec.rake
|
74
|
+
homepage: https://github.com/paustint/aria_sdk_unofficial
|
75
|
+
licenses: []
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5.1
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: 'Aria REST SDK based on the official Aria SDK located here: https://github.com/AriaSystems/ruby_sdk'
|
97
|
+
test_files: []
|