Class: Algolia::Analytics
- Inherits:
-
Object
- Object
- Algolia::Analytics
- Defined in:
- lib/algolia/analytics.rb
Constant Summary collapse
- API_URL =
'https://analytics.algolia.com'
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#ssl ⇒ Object
readonly
Returns the value of attribute ssl.
-
#ssl_version ⇒ Object
readonly
Returns the value of attribute ssl_version.
Instance Method Summary collapse
- #add_ab_test(ab_test) ⇒ Object
- #delete_ab_test(ab_test_id) ⇒ Object
- #get_ab_test(ab_test_id) ⇒ Object
- #get_ab_tests(params = {}) ⇒ Object
-
#initialize(client, params) ⇒ Analytics
constructor
A new instance of Analytics.
- #stop_ab_test(ab_test_id) ⇒ Object
- #wait_task(index_name, taskID, time_before_retry = WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options = {}) ⇒ Object
Constructor Details
#initialize(client, params) ⇒ Analytics
Returns a new instance of Analytics.
7 8 9 10 |
# File 'lib/algolia/analytics.rb', line 7 def initialize(client, params) @client = client @headers = params[:headers] end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/algolia/analytics.rb', line 4 def headers @headers end |
#ssl ⇒ Object (readonly)
Returns the value of attribute ssl.
4 5 6 |
# File 'lib/algolia/analytics.rb', line 4 def ssl @ssl end |
#ssl_version ⇒ Object (readonly)
Returns the value of attribute ssl_version.
4 5 6 |
# File 'lib/algolia/analytics.rb', line 4 def ssl_version @ssl_version end |
Instance Method Details
#add_ab_test(ab_test) ⇒ Object
27 28 29 |
# File 'lib/algolia/analytics.rb', line 27 def add_ab_test(ab_test) perform_request(:POST, Protocol.ab_tests_uri, {}, ab_test.to_json) end |
#delete_ab_test(ab_test_id) ⇒ Object
37 38 39 40 41 |
# File 'lib/algolia/analytics.rb', line 37 def delete_ab_test(ab_test_id) raise ArgumentError.new('ab_test_id cannot be empty') if ab_test_id.nil? || ab_test_id == '' perform_request(:DELETE, Protocol.ab_tests_uri(ab_test_id)) end |
#get_ab_test(ab_test_id) ⇒ Object
21 22 23 24 25 |
# File 'lib/algolia/analytics.rb', line 21 def get_ab_test(ab_test_id) raise ArgumentError.new('ab_test_id cannot be empty') if ab_test_id.nil? || ab_test_id == '' perform_request(:GET, Protocol.ab_tests_uri(ab_test_id)) end |
#get_ab_tests(params = {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/algolia/analytics.rb', line 12 def get_ab_tests(params = {}) params = { :offset => 0, :limit => 10, }.merge(params) perform_request(:GET, Protocol.ab_tests_uri, params) end |
#stop_ab_test(ab_test_id) ⇒ Object
31 32 33 34 35 |
# File 'lib/algolia/analytics.rb', line 31 def stop_ab_test(ab_test_id) raise ArgumentError.new('ab_test_id cannot be empty') if ab_test_id.nil? || ab_test_id == '' perform_request(:POST, Protocol.ab_tests_stop_uri(ab_test_id)) end |
#wait_task(index_name, taskID, time_before_retry = WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options = {}) ⇒ Object
43 44 45 |
# File 'lib/algolia/analytics.rb', line 43 def wait_task(index_name, taskID, time_before_retry = WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, = {}) @client.wait_task(index_name, taskID, time_before_retry, ) end |