Class: DataSift::AccountIdentity
- Inherits:
-
ApiResource
- Object
- ApiResource
- DataSift::AccountIdentity
- Defined in:
- lib/account_identity.rb
Overview
Class for accessing DataSift’s Account API Identities
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(label = '', status = 'active', master = '') ⇒ Object
Creates a new Identity.
-
#delete(id) ⇒ Object
Deletes a specific Identity by ID.
-
#get(id) ⇒ Object
Gets a specific Identity by ID.
-
#list(label = '', per_page = '', page = '') ⇒ Object
Returns a list of Identities.
-
#update(id = '', label = '', status = '', master = '') ⇒ Object
Updates a specific Identity by ID.
Methods inherited from ApiResource
Methods included from DataSift
Constructor Details
This class inherits a constructor from DataSift::ApiResource
Instance Method Details
#create(label = '', status = 'active', master = '') ⇒ Object
Creates a new Identity
13 14 15 16 17 18 19 20 21 |
# File 'lib/account_identity.rb', line 13 def create(label = '', status = 'active', master = '') fail ArgumentError, 'label is missing' if label.empty? params = { label: label } params.merge!(status: status) unless status.empty? params.merge!(master: master) if [TrueClass, FalseClass].include?(master.class) DataSift.request(:POST, 'account/identity', @config, params) end |
#delete(id) ⇒ Object
Deletes a specific Identity by ID
69 70 71 |
# File 'lib/account_identity.rb', line 69 def delete(id) DataSift.request(:DELETE, "account/identity/#{id}", @config) end |
#get(id) ⇒ Object
Gets a specific Identity by ID
27 28 29 |
# File 'lib/account_identity.rb', line 27 def get(id) DataSift.request(:GET, "account/identity/#{id}", @config) end |
#list(label = '', per_page = '', page = '') ⇒ Object
Returns a list of Identities
38 39 40 41 42 43 44 45 |
# File 'lib/account_identity.rb', line 38 def list(label = '', per_page = '', page = '') params = {} params.merge!(label: label) unless label.empty? params.merge!(per_page: per_page) unless per_page.empty? params.merge!(page: page) unless page.empty? DataSift.request(:GET, 'account/identity', @config, params) end |
#update(id = '', label = '', status = '', master = '') ⇒ Object
Updates a specific Identity by ID
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/account_identity.rb', line 54 def update(id = '', label = '', status = '', master = '') fail ArgumentError, 'id is missing' if id.empty? params = {} params.merge!(label: label) unless label.empty? params.merge!(status: status) unless status.empty? params.merge!(master: master) if [TrueClass, FalseClass].include?(master.class) DataSift.request(:PUT, "account/identity/#{id}", @config, params) end |