Class: Aria
- Inherits:
-
Object
- Object
- Aria
- Defined in:
- lib/aria_sdk_unofficial.rb
Instance Attribute Summary collapse
-
#auth_key ⇒ Object
Returns the value of attribute auth_key.
-
#client_no ⇒ Object
Returns the value of attribute client_no.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #call(api_name, options = {}, remove_nil = false) ⇒ Object
- #get_url(api_type, env_type) ⇒ Object
-
#initialize(client_no:, auth_key:, api_type:, env_type:, api_name: nil) ⇒ Aria
constructor
A new instance of Aria.
Constructor Details
#initialize(client_no:, auth_key:, api_type:, env_type:, api_name: nil) ⇒ Aria
Returns a new instance of Aria.
9 10 11 12 13 |
# File 'lib/aria_sdk_unofficial.rb', line 9 def initialize(client_no:, auth_key:, api_type:, env_type:, api_name: nil) self.client_no = client_no self.auth_key = auth_key self.url = get_url api_type, env_type end |
Instance Attribute Details
#auth_key ⇒ Object
Returns the value of attribute auth_key.
7 8 9 |
# File 'lib/aria_sdk_unofficial.rb', line 7 def auth_key @auth_key end |
#client_no ⇒ Object
Returns the value of attribute client_no.
7 8 9 |
# File 'lib/aria_sdk_unofficial.rb', line 7 def client_no @client_no end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/aria_sdk_unofficial.rb', line 7 def url @url end |
Instance Method Details
#call(api_name, options = {}, remove_nil = false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/aria_sdk_unofficial.rb', line 15 def call(api_name, = {}, remove_nil=false) defaults = { :output_format => 'json', :client_no => self.client_no, :auth_key => self.auth_key, :rest_call => api_name } if remove_nil .keys.each { |x| .delete x if [x].nil? } end .merge!(defaults) HTTParty.post(self.url, :body => ) end |
#get_url(api_type, env_type) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/aria_sdk_unofficial.rb', line 32 def get_url(api_type, env_type) env_url = '' full_url = '' if env_type == 0 # SF env_url += '.future.stage' elsif env_type == 1 # SC env_url += '.current.stage' elsif env_type == 3 # SF CPH env_url += '.future.stage.cph' elsif env_type == 4 # Prod CPH env_url = '.cph' end if api_type == 0 # core full_url = "https://secure#{env_url}.ariasystems.net/api/ws/api_ws_class_dispatcher.php" elsif api_type == 1 # object full_url = "https://secure#{env_url}.ariasystems.net/api/AriaQuery/objects.php" else # admin full_url = "https://admintools#{env_url}.ariasystems.net/AdminTools.php/Dispatcher" end return full_url end |