Class: DataSift::AccountIdentityLimit
- Inherits:
-
ApiResource
- Object
- ApiResource
- DataSift::AccountIdentityLimit
- Defined in:
- lib/account_identity_limit.rb
Overview
Class for accessing DataSift’s Account API Identity Limits
Constant Summary
Constants inherited from ApiResource
DataSift::ApiResource::TLSv1, DataSift::ApiResource::TLSv1_2
Constants included from DataSift
APPLICATION_JSON, DELETE, DETECT_DEAD_SOCKETS, GET, HEAD, IS_WINDOWS, KNOWN_SOCKETS, SOCKET_DETECTOR_TIMEOUT, VERSION, X_ANALYSIS_TASKS_QUEUED, X_ANALYSIS_TASKS_QUEUE_LIMIT, X_INSIGHT_TASKS_QUEUED, X_INSIGHT_TASKS_QUEUE_LIMIT, X_RATELIMIT_COST, X_RATELIMIT_LIMIT, X_RATELIMIT_REMAINING, X_TASKS_QUEUED, X_TASKS_QUEUE_LIMIT
Instance Method Summary collapse
-
#create(identity_id = '', service = '', total_allowance = nil, analyze_queries = nil) ⇒ Object
Creates a Limit for an Identity.
-
#delete(identity_id = '', service = '') ⇒ Object
Removes a Service Limit for an Identity.
-
#get(identity_id = '', service = '') ⇒ Object
Get the Limit for a given Identity and Service.
-
#list(service = '', per_page = '', page = '') ⇒ Object
Returns a list Identities and their Limits for a given Service.
-
#update(identity_id = '', service = '', total_allowance = nil, analyze_queries = nil) ⇒ Object
Updates a Limit for an Identity by Service.
Methods inherited from ApiResource
Methods included from DataSift
Constructor Details
This class inherits a constructor from DataSift::ApiResource
Instance Method Details
#create(identity_id = '', service = '', total_allowance = nil, analyze_queries = nil) ⇒ Object
Creates a Limit for an Identity
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/account_identity_limit.rb', line 14 def create(identity_id = '', service = '', total_allowance = nil, analyze_queries = nil) fail BadParametersError, 'identity_id is required' if identity_id.empty? fail BadParametersError, 'service is required' if service.empty? fail BadParametersError, 'Must set total_allowance or analyze_queries' if total_allowance.nil? && analyze_queries.nil? params = { service: service } params[:total_allowance] = total_allowance unless total_allowance.nil? params[:analyze_queries] = analyze_queries unless analyze_queries.nil? DataSift.request(:POST, "account/identity/#{identity_id}/limit", @config, params) end |
#delete(identity_id = '', service = '') ⇒ Object
Removes a Service Limit for an Identity
83 84 85 86 87 88 |
# File 'lib/account_identity_limit.rb', line 83 def delete(identity_id = '', service = '') fail BadParametersError, 'identity_id is required' if identity_id.empty? fail BadParametersError, 'service is required' if service.empty? DataSift.request(:DELETE, "account/identity/#{identity_id}/limit/#{service}", @config) end |
#get(identity_id = '', service = '') ⇒ Object
Get the Limit for a given Identity and Service
32 33 34 35 36 37 |
# File 'lib/account_identity_limit.rb', line 32 def get(identity_id = '', service = '') fail BadParametersError, 'identity_id is required' if identity_id.empty? fail BadParametersError, 'service is required' if service.empty? DataSift.request(:GET, "account/identity/#{identity_id}/limit/#{service}", @config) end |
#list(service = '', per_page = '', page = '') ⇒ Object
Returns a list Identities and their Limits for a given Service
46 47 48 49 50 51 52 53 54 |
# File 'lib/account_identity_limit.rb', line 46 def list(service = '', per_page = '', page = '') fail BadParametersError, 'service is required' if service.empty? params = {} params[:per_page] = per_page unless per_page.empty? params[:page] = page unless page.empty? DataSift.request(:GET, "account/identity/limit/#{service}", @config, params) end |
#update(identity_id = '', service = '', total_allowance = nil, analyze_queries = nil) ⇒ Object
Updates a Limit for an Identity by Service
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/account_identity_limit.rb', line 65 def update(identity_id = '', service = '', total_allowance = nil, analyze_queries = nil) fail BadParametersError, 'identity_id is required' if identity_id.empty? fail BadParametersError, 'service is required' if service.empty? fail BadParametersError, 'Must set total_allowance or analyze_queries' if total_allowance.nil? && analyze_queries.nil? params = {} params[:total_allowance] = total_allowance unless total_allowance.nil? params[:analyze_queries] = analyze_queries unless analyze_queries.nil? DataSift.request(:PUT, "account/identity/#{identity_id}/limit/#{service}", @config, params) end |