Class: DataSift::Pylon
- Inherits:
-
ApiResource
- Object
- ApiResource
- DataSift::Pylon
- Defined in:
- lib/pylon.rb
Overview
Class for accessing DataSift’s PYLON API
Constant Summary
Constants inherited from ApiResource
ApiResource::TLSv1, 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
-
#analyze(hash = '', parameters = '', filter = '', start_time = nil, end_time = nil, id = '', service = 'facebook') ⇒ Object
Perform a PYLON analysis query by making an /pylon/analyze API call.
-
#compile(csdl, service = 'facebook') ⇒ Object
Compile PYLON CSDL by making an /pylon/compile API call.
-
#get(hash = '', id = '', service = 'facebook') ⇒ Object
Perform /pylon/get API call to query status of your PYLON recordings.
-
#list(page = nil, per_page = nil, order_by = '', order_dir = '', service = 'facebook') ⇒ Object
Perform /pylon/get API call to list all PYLON Recordings.
-
#reference(service:, slug: '', **opts) ⇒ Object
Hit the PYLON Reference endpoint to expose reference data sets.
-
#restart(id, name = '', service = 'facebook') ⇒ Object
Restart an existing PYLON recording by making an /pylon/start API call with a recording ID.
-
#sample(hash = '', count = nil, start_time = nil, end_time = nil, filter = '', id = '', service = 'facebook') ⇒ Object
Hit the PYLON Sample endpoint to pull public sample data from a PYLON recording.
-
#start(hash = '', name = '', id = '', service = 'facebook') ⇒ Object
Start recording a PYLON filter by making an /pylon/start API call.
-
#stop(hash = '', id = '', service = 'facebook') ⇒ Object
Stop an active PYLON recording by making an /pylon/stop API call.
-
#tags(hash = '', id = '', service = 'facebook') ⇒ Object
Query the tag hierarchy on interactions populated by a particular recording.
-
#update(id, hash = '', name = '', service = 'facebook') ⇒ Object
Perform /pylon/update API call to update a given PYLON Recording.
-
#valid?(csdl = '', boolResponse = true, service = 'facebook') ⇒ Boolean, Object
Check PYLON CSDL is valid by making an /pylon/validate API call.
Methods inherited from ApiResource
Methods included from DataSift
Constructor Details
This class inherits a constructor from DataSift::ApiResource
Instance Method Details
#analyze(hash = '', parameters = '', filter = '', start_time = nil, end_time = nil, id = '', service = 'facebook') ⇒ Object
Perform a PYLON analysis query by making an /pylon/analyze API call
159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/pylon.rb', line 159 def analyze(hash = '', parameters = '', filter = '', start_time = nil, end_time = nil, id = '', service = 'facebook') fail BadParametersError, 'hash or id is required' if hash.empty? && id.empty? fail BadParametersError, 'parameters is required' if parameters.empty? fail BadParametersError, 'service is required' if service.empty? params = { parameters: parameters } params.merge!(hash: hash) unless hash.empty? params.merge!(id: id) unless id.empty? params.merge!(filter: filter) unless filter.empty? params.merge!(start: start_time) unless start_time.nil? params.merge!(end: end_time) unless end_time.nil? DataSift.request(:POST, build_path(service, 'pylon/analyze', @config), @config, params) end |
#compile(csdl, service = 'facebook') ⇒ Object
Compile PYLON CSDL by making an /pylon/compile API call
27 28 29 30 31 32 33 34 |
# File 'lib/pylon.rb', line 27 def compile(csdl, service = 'facebook') fail BadParametersError, 'csdl is required' if csdl.empty? fail BadParametersError, 'service is required' if service.empty? params = { csdl: csdl } DataSift.request(:POST, build_path(service, 'pylon/compile', @config), @config, params) end |
#get(hash = '', id = '', service = 'facebook') ⇒ Object
Perform /pylon/get API call to query status of your PYLON recordings
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pylon.rb', line 42 def get(hash = '', id = '', service = 'facebook') fail BadParametersError, 'hash or id is required' if hash.empty? && id.empty? fail BadParametersError, 'service is required' if service.empty? params = {} params.merge!(hash: hash) unless hash.empty? params.merge!(id: id) unless id.empty? DataSift.request(:GET, build_path(service, 'pylon/get', @config), @config, params) end |
#list(page = nil, per_page = nil, order_by = '', order_dir = '', service = 'facebook') ⇒ Object
Perform /pylon/get API call to list all PYLON Recordings
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/pylon.rb', line 62 def list(page = nil, per_page = nil, order_by = '', order_dir = '', service = 'facebook') fail BadParametersError, 'service is required' if service.empty? params = {} params.merge!(page: page) unless page.nil? params.merge!(per_page: per_page) unless per_page.nil? params.merge!(order_by: order_by) unless order_by.empty? params.merge!(order_dir: order_dir) unless order_dir.empty? DataSift.request(:GET, build_path(service, 'pylon/get', @config), @config, params) end |
#reference(service:, slug: '', **opts) ⇒ Object
Hit the PYLON Reference endpoint to expose reference data sets
**opts
228 229 230 231 232 233 234 |
# File 'lib/pylon.rb', line 228 def reference(service:, slug: '', **opts) params = {} params[:per_page] = opts[:per_page] if opts.key?(:per_page) params[:page] = opts[:page] if opts.key?(:page) DataSift.request(:GET, "pylon/#{service}/reference/#{slug}", @config, params) end |
#restart(id, name = '', service = 'facebook') ⇒ Object
Restart an existing PYLON recording by making an /pylon/start API call with a recording ID
118 119 120 121 122 123 124 125 126 |
# File 'lib/pylon.rb', line 118 def restart(id, name = '', service = 'facebook') fail BadParametersError, 'id is required' if id.empty? fail BadParametersError, 'service is required' if service.empty? params = { id: id } params.merge!(name: name) unless name.empty? DataSift.request(:PUT, build_path(service, 'pylon/start', @config), @config, params) end |
#sample(hash = '', count = nil, start_time = nil, end_time = nil, filter = '', id = '', service = 'facebook') ⇒ Object
Hit the PYLON Sample endpoint to pull public sample data from a PYLON recording
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/pylon.rb', line 202 def sample(hash = '', count = nil, start_time = nil, end_time = nil, filter = '', id = '', service = 'facebook') fail BadParametersError, 'hash or id is required' if hash.empty? && id.empty? fail BadParametersError, 'service is required' if service.empty? params = {} params.merge!(hash: hash) unless hash.empty? params.merge!(id: id) unless id.empty? params.merge!(count: count) unless count.nil? params.merge!(start_time: start_time) unless start_time.nil? params.merge!(end_time: end_time) unless end_time.nil? if filter.empty? DataSift.request(:GET, build_path(service, 'pylon/sample', @config), @config, params) else params.merge!(filter: filter) DataSift.request(:POST, build_path(service, 'pylon/sample', @config), @config, params) end end |
#start(hash = '', name = '', id = '', service = 'facebook') ⇒ Object
Start recording a PYLON filter by making an /pylon/start API call
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/pylon.rb', line 99 def start(hash = '', name = '', id = '', service = 'facebook') fail BadParametersError, 'hash or id is required' if hash.empty? && id.empty? fail BadParametersError, 'service is required' if service.empty? params = {} params.merge!(hash: hash) unless hash.empty? params.merge!(name: name) unless name.empty? params.merge!(id: id) unless id.empty? DataSift.request(:PUT, build_path(service, 'pylon/start', @config), @config, params) end |
#stop(hash = '', id = '', service = 'facebook') ⇒ Object
Stop an active PYLON recording by making an /pylon/stop API call
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/pylon.rb', line 134 def stop(hash = '', id = '', service = 'facebook') fail BadParametersError, 'hash or id is required' if hash.empty? && id.empty? fail BadParametersError, 'service is required' if service.empty? params = {} params.merge!(hash: hash) unless hash.empty? params.merge!(id: id) unless id.empty? DataSift.request(:PUT, build_path(service, 'pylon/stop', @config), @config, params) end |
#tags(hash = '', id = '', service = 'facebook') ⇒ Object
Query the tag hierarchy on interactions populated by a particular
recording
181 182 183 184 185 186 187 188 189 190 |
# File 'lib/pylon.rb', line 181 def (hash = '', id = '', service = 'facebook') fail BadParametersError, 'hash or id is required' if hash.empty? && id.empty? fail BadParametersError, 'service is required' if service.empty? params = {} params.merge!(hash: hash) unless hash.empty? params.merge!(id: id) unless id.empty? DataSift.request(:GET, build_path(service, 'pylon/tags', @config), @config, params) end |
#update(id, hash = '', name = '', service = 'facebook') ⇒ Object
Perform /pylon/update API call to update a given PYLON Recording
81 82 83 84 85 86 87 88 89 |
# File 'lib/pylon.rb', line 81 def update(id, hash = '', name = '', service = 'facebook') fail BadParametersError, 'service is required' if service.empty? params = { id: id } params.merge!(hash: hash) unless hash.empty? params.merge!(name: name) unless name.empty? DataSift.request(:PUT, build_path(service, 'pylon/update', @config), @config, params) end |
#valid?(csdl = '', boolResponse = true, service = 'facebook') ⇒ Boolean, Object
Check PYLON CSDL is valid by making an /pylon/validate API call
12 13 14 15 16 17 18 19 20 |
# File 'lib/pylon.rb', line 12 def valid?(csdl = '', boolResponse = true, service = 'facebook') fail BadParametersError, 'csdl is required' if csdl.empty? fail BadParametersError, 'service is required' if service.empty? params = { csdl: csdl } res = DataSift.request(:POST, build_path(service, 'pylon/validate', @config), @config, params) boolResponse ? res[:http][:status] == 200 : res end |