Module: EvoleapLicensing::WebService
- Defined in:
- lib/evoleap_licensing/web_service.rb
Class Method Summary collapse
- .begin_user_session(product_id:, instance_id:, version:, user_identity:, public_key:, client:, session_duration: nil) ⇒ Object
- .check_in_components(product_id:, auth_token:, session_key:, component_names:, public_key:, client:) ⇒ Object
- .check_out_components(product_id:, auth_token:, session_key:, component_names:, public_key:, client:) ⇒ Object
- .components_status(product_id:, auth_token:, session_key:, public_key:, client:) ⇒ Object
- .end_session(product_id:, auth_token:, session_key:, public_key:, client:) ⇒ Object
- .extend_session(product_id:, auth_token:, session_key:, public_key:, client:, session_duration: nil) ⇒ Object
- .get_license_info(product_id:, auth_token:, session_key:, public_key:, client:) ⇒ Object
- .register_instance(product_id:, license_key:, hardware_identity:, public_key:, client:) ⇒ Object
- .register_user(product_id:, instance_id:, user_info:, user_identity:, public_key:, client:) ⇒ Object
- .validate_instance(product_id:, instance_id:, version:, hardware_identity:, public_key:, client:) ⇒ Object
Class Method Details
.begin_user_session(product_id:, instance_id:, version:, user_identity:, public_key:, client:, session_duration: nil) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/evoleap_licensing/web_service.rb', line 42 def self.begin_user_session(product_id:, instance_id:, version:, user_identity:, public_key:, client:, session_duration: nil) post_data = { product_guid: product_id, instance_guid: instance_id, version: version, user_identity: user_identity } post_data[:session_duration] = session_duration if session_duration encrypted_call(:begin_user_session, product_id, post_data, public_key, client, general_error: ->(msg) { validation_error(msg, ValidationStatus.general_error) }, connection_error: ->(msg) { validation_error(msg, ValidationStatus.service_unreachable) }) end |
.check_in_components(product_id:, auth_token:, session_key:, component_names:, public_key:, client:) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/evoleap_licensing/web_service.rb', line 94 def self.check_in_components(product_id:, auth_token:, session_key:, component_names:, public_key:, client:) post_data = { product_guid: product_id, token: auth_token, session_key: session_key, component_names: component_names } encrypted_call(:check_in_components, product_id, post_data, public_key, client, general_error: ->(msg) { { "status" => ValidationStatus.general_error, "error" => msg } }, connection_error: ->(msg) { { "status" => ValidationStatus.service_unreachable, "error" => msg } }) end |
.check_out_components(product_id:, auth_token:, session_key:, component_names:, public_key:, client:) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/evoleap_licensing/web_service.rb', line 81 def self.check_out_components(product_id:, auth_token:, session_key:, component_names:, public_key:, client:) post_data = { product_guid: product_id, token: auth_token, session_key: session_key, component_names: component_names } encrypted_call(:check_out_components, product_id, post_data, public_key, client, general_error: ->(msg) { { "status" => ValidationStatus.general_error, "error" => msg } }, connection_error: ->(msg) { { "status" => ValidationStatus.service_unreachable, "error" => msg } }) end |
.components_status(product_id:, auth_token:, session_key:, public_key:, client:) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/evoleap_licensing/web_service.rb', line 107 def self.components_status(product_id:, auth_token:, session_key:, public_key:, client:) post_data = { product_guid: product_id, token: auth_token, session_key: session_key } encrypted_call(:components_status, product_id, post_data, public_key, client, general_error: ->(msg) { { "status" => ValidationStatus.general_error, "error" => msg } }, connection_error: ->(msg) { { "status" => ValidationStatus.service_unreachable, "error" => msg } }) end |
.end_session(product_id:, auth_token:, session_key:, public_key:, client:) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/evoleap_licensing/web_service.rb', line 69 def self.end_session(product_id:, auth_token:, session_key:, public_key:, client:) post_data = { product_guid: product_id, token: auth_token, session_key: session_key } encrypted_call(:end_session, product_id, post_data, public_key, client, general_error: ->(msg) { { "error" => msg } }, connection_error: ->(msg) { { "error" => "Error contacting licensing service. #{msg}" } }) end |
.extend_session(product_id:, auth_token:, session_key:, public_key:, client:, session_duration: nil) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/evoleap_licensing/web_service.rb', line 56 def self.extend_session(product_id:, auth_token:, session_key:, public_key:, client:, session_duration: nil) post_data = { product_guid: product_id, token: auth_token, session_key: session_key } post_data[:session_duration] = session_duration if session_duration encrypted_call(:extend_session, product_id, post_data, public_key, client, general_error: ->(msg) { validation_error(msg, ValidationStatus.general_error) }, connection_error: ->(msg) { validation_error(msg, ValidationStatus.service_unreachable) }) end |
.get_license_info(product_id:, auth_token:, session_key:, public_key:, client:) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/evoleap_licensing/web_service.rb', line 119 def self.get_license_info(product_id:, auth_token:, session_key:, public_key:, client:) post_data = { product_guid: product_id, token: auth_token, session_key: session_key } encrypted_call(:get_license_info, product_id, post_data, public_key, client, general_error: ->(msg) { { "status" => ValidationStatus.general_error, "error" => msg } }, connection_error: ->(msg) { { "status" => ValidationStatus.service_unreachable, "error" => msg } }) end |
.register_instance(product_id:, license_key:, hardware_identity:, public_key:, client:) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/evoleap_licensing/web_service.rb', line 7 def self.register_instance(product_id:, license_key:, hardware_identity:, public_key:, client:) post_data = { product_guid: product_id, license_key: license_key } add_hardware_identity(post_data, hardware_identity) encrypted_call(:register_instance, product_id, post_data, public_key, client, general_error: ->(msg) { registration_general_error(msg) }, connection_error: ->(msg) { registration_connection_error(msg) }) end |
.register_user(product_id:, instance_id:, user_info:, user_identity:, public_key:, client:) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/evoleap_licensing/web_service.rb', line 29 def self.register_user(product_id:, instance_id:, user_info:, user_identity:, public_key:, client:) post_data = { product_guid: product_id, instance_guid: instance_id, user_info: { name: user_info[:name], email: user_info[:email] }, user_identity: user_identity } encrypted_call(:register_user, product_id, post_data, public_key, client, general_error: ->(msg) { registration_general_error(msg) }, connection_error: ->(msg) { registration_connection_error(msg) }) end |
.validate_instance(product_id:, instance_id:, version:, hardware_identity:, public_key:, client:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/evoleap_licensing/web_service.rb', line 16 def self.validate_instance(product_id:, instance_id:, version:, hardware_identity:, public_key:, client:) post_data = { product_guid: product_id, instance_guid: instance_id, version: version } add_hardware_identity(post_data, hardware_identity) encrypted_call(:validate_instance, product_id, post_data, public_key, client, general_error: ->(msg) { validation_error(msg, ValidationStatus.general_error) }, connection_error: ->(msg) { validation_error(msg, ValidationStatus.service_unreachable) }) end |