datasift 3.1.5 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.yardopts +4 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +13 -0
- data/README.md +17 -16
- data/VERSION +1 -1
- data/datasift.gemspec +8 -14
- data/examples/account_identity_eg.rb +48 -0
- data/examples/account_identity_limit_eg.rb +68 -0
- data/examples/account_identity_token_eg.rb +70 -0
- data/examples/auth.rb +4 -4
- data/examples/core_api_eg.rb +1 -2
- data/examples/historics_eg.rb +7 -1
- data/examples/pylon_eg.rb +116 -0
- data/lib/account.rb +6 -0
- data/lib/account_identity.rb +73 -0
- data/lib/account_identity_limit.rb +85 -0
- data/lib/account_identity_token.rb +86 -0
- data/lib/api/api_resource.rb +14 -5
- data/lib/cli.rb +306 -132
- data/lib/datasift.rb +82 -47
- data/lib/errors.rb +21 -5
- data/lib/historics.rb +71 -40
- data/lib/historics_preview.rb +25 -8
- data/lib/managed_source.rb +69 -25
- data/lib/managed_source_auth.rb +21 -6
- data/lib/managed_source_resource.rb +21 -6
- data/lib/push.rb +132 -65
- data/lib/pylon.rb +122 -0
- data/test/datasift/core_api_test.rb +116 -90
- data/test/datasift/historics_preview_api_test.rb +27 -58
- data/test/datasift/push_api_test.rb +156 -141
- data/test/fixtures/cassettes/core/after_historic_dpu.json +1 -0
- data/test/fixtures/cassettes/core/balance_get.json +1 -0
- data/test/fixtures/cassettes/core/before_dpu.json +1 -0
- data/test/fixtures/cassettes/core/before_historic_dpu.json +1 -0
- data/test/fixtures/cassettes/core/compile_success.json +1 -0
- data/test/fixtures/cassettes/core/dpu_get_cost.json +1 -0
- data/test/fixtures/cassettes/core/dpu_throw_badrequest.json +1 -0
- data/test/fixtures/cassettes/core/historic_dpu.json +1 -0
- data/test/fixtures/cassettes/core/usage_success.json +1 -0
- data/test/fixtures/cassettes/core/validate_invalid_hash.json +1 -0
- data/test/fixtures/cassettes/core/validate_success_bool.json +1 -0
- data/test/fixtures/cassettes/core/validate_success_hash.json +1 -0
- data/test/fixtures/cassettes/preview/before_preview_create.json +1 -0
- data/test/fixtures/cassettes/preview/before_preview_get.json +1 -0
- data/test/fixtures/cassettes/preview/preview_create_success.json +1 -0
- data/test/fixtures/cassettes/preview/preview_get_success.json +1 -0
- data/test/fixtures/cassettes/push/after_push_create.json +1 -0
- data/test/fixtures/cassettes/push/after_push_get.json +1 -0
- data/test/fixtures/cassettes/push/after_push_log.json +1 -0
- data/test/fixtures/cassettes/push/after_push_pause.json +1 -0
- data/test/fixtures/cassettes/push/after_push_resume.json +1 -0
- data/test/fixtures/cassettes/push/after_push_stop.json +1 -0
- data/test/fixtures/cassettes/push/after_push_update.json +1 -0
- data/test/fixtures/cassettes/push/before_push_create.json +1 -0
- data/test/fixtures/cassettes/push/before_push_delete.json +1 -0
- data/test/fixtures/cassettes/push/before_push_get.json +1 -0
- data/test/fixtures/cassettes/push/before_push_log.json +1 -0
- data/test/fixtures/cassettes/push/before_push_pause.json +1 -0
- data/test/fixtures/cassettes/push/before_push_resume.json +1 -0
- data/test/fixtures/cassettes/push/before_push_stop.json +1 -0
- data/test/fixtures/cassettes/push/before_push_update.json +1 -0
- data/test/fixtures/cassettes/push/push_create.json +1 -0
- data/test/fixtures/cassettes/push/push_delete.json +1 -0
- data/test/fixtures/cassettes/push/push_get_by_id.json +1 -0
- data/test/fixtures/cassettes/push/push_log_with_id.json +1 -0
- data/test/fixtures/cassettes/push/push_pause.json +1 -0
- data/test/fixtures/cassettes/push/push_resume.json +1 -0
- data/test/fixtures/cassettes/push/push_stop.json +1 -0
- data/test/fixtures/cassettes/push/push_update.json +1 -0
- data/test/fixtures/cassettes/push/push_validate.json +1 -0
- data/test/test_helper.rb +31 -1
- metadata +64 -104
- data/examples/dynamic_list_eg.rb +0 -74
- data/examples/dynamic_list_replace_eg.rb +0 -45
- data/lib/dynamic_list.rb +0 -66
- data/lib/dynamic_list_replace.rb +0 -45
- data/test/fixtures/balance.json +0 -1
- data/test/fixtures/compile_csdl_invalid.json +0 -1
- data/test/fixtures/compile_csdl_valid.json +0 -1
- data/test/fixtures/dpu_valid.json +0 -1
- data/test/fixtures/preview_create_valid.json +0 -1
- data/test/fixtures/preview_get_running.json +0 -1
- data/test/fixtures/preview_get_succeeded.json +0 -1
- data/test/fixtures/push_create_valid.json +0 -1
- data/test/fixtures/push_get_list_by_hash_valid.json +0 -1
- data/test/fixtures/push_get_list_by_historics_id_valid.json +0 -1
- data/test/fixtures/push_get_list_valid.json +0 -1
- data/test/fixtures/push_get_valid.json +0 -1
- data/test/fixtures/push_log_valid.json +0 -1
- data/test/fixtures/push_pause_valid.json +0 -1
- data/test/fixtures/push_stop_valid.json +0 -1
- data/test/fixtures/push_validate_valid.json +0 -1
- data/test/fixtures/usage_current.json +0 -1
- data/test/fixtures/validate_csdl_invalid.json +0 -1
- data/test/fixtures/validate_csdl_valid.json +0 -1
data/lib/dynamic_list.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
module DataSift
|
2
|
-
class DynamicList < DataSift::ApiResource
|
3
|
-
|
4
|
-
##
|
5
|
-
# Get all lists and their ids.
|
6
|
-
def get
|
7
|
-
params = {}
|
8
|
-
requires params
|
9
|
-
DataSift.request(:GET, 'list/get', @config, params)
|
10
|
-
end
|
11
|
-
|
12
|
-
##
|
13
|
-
# Create a new dynamic list
|
14
|
-
def create (type, name)
|
15
|
-
params = {
|
16
|
-
:type => type
|
17
|
-
}
|
18
|
-
requires params
|
19
|
-
params[:name] = name
|
20
|
-
DataSift.request(:POST, 'list/create', @config, params)
|
21
|
-
end
|
22
|
-
|
23
|
-
##
|
24
|
-
# Delete a dynamic list
|
25
|
-
def delete (id)
|
26
|
-
params = {
|
27
|
-
:id => id
|
28
|
-
}
|
29
|
-
requires params
|
30
|
-
DataSift.request(:DELETE, 'list/delete', @config, params)
|
31
|
-
end
|
32
|
-
|
33
|
-
##
|
34
|
-
# Check if items exist in given list
|
35
|
-
def exists (id, items)
|
36
|
-
params = {
|
37
|
-
:id => id,
|
38
|
-
:items => items
|
39
|
-
}
|
40
|
-
requires params
|
41
|
-
DataSift.request(:POST, 'list/exists', @config, params)
|
42
|
-
end
|
43
|
-
|
44
|
-
##
|
45
|
-
# Add items to a given list
|
46
|
-
def add (id, items)
|
47
|
-
params = {
|
48
|
-
:id => id,
|
49
|
-
:items => items
|
50
|
-
}
|
51
|
-
requires params
|
52
|
-
DataSift.request(:POST, 'list/add', @config, params)
|
53
|
-
end
|
54
|
-
|
55
|
-
##
|
56
|
-
# Remove items from a given list
|
57
|
-
def remove (id, items)
|
58
|
-
params = {
|
59
|
-
:id => id,
|
60
|
-
:items => items
|
61
|
-
}
|
62
|
-
requires params
|
63
|
-
DataSift.request(:POST, 'list/remove', @config, params)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
data/lib/dynamic_list_replace.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
module DataSift
|
2
|
-
class DynamicListReplace < DataSift::ApiResource
|
3
|
-
|
4
|
-
##
|
5
|
-
# Start a new replace list
|
6
|
-
def start (list_id)
|
7
|
-
params = {
|
8
|
-
:list_id => list_id
|
9
|
-
}
|
10
|
-
requires params
|
11
|
-
DataSift.request(:POST, 'list/replace/start', @config, params)
|
12
|
-
end
|
13
|
-
|
14
|
-
##
|
15
|
-
# Commit the replace list
|
16
|
-
def commit (id)
|
17
|
-
params = {
|
18
|
-
:id => id
|
19
|
-
}
|
20
|
-
requires params
|
21
|
-
DataSift.request(:POST, 'list/replace/commit', @config, params)
|
22
|
-
end
|
23
|
-
|
24
|
-
##
|
25
|
-
# Abort the replace list
|
26
|
-
def abort (id)
|
27
|
-
params = {
|
28
|
-
:id => id
|
29
|
-
}
|
30
|
-
requires params
|
31
|
-
DataSift.request(:POST, 'list/replace/abort', @config, params)
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Add items to the replace list
|
36
|
-
def add (id, items)
|
37
|
-
params = {
|
38
|
-
:id => id,
|
39
|
-
:items => items
|
40
|
-
}
|
41
|
-
requires params
|
42
|
-
DataSift.request(:POST, 'list/replace/add', @config, params)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/test/fixtures/balance.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"balance":{"remaining_dpus":-847.8,"cost":0,"plan":"professional","threshold":500}}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"error":"We are unable to parse this stream. At line 1 position 21 we were expecting one of: an operator that can act on strings, integers or float types (==, !=, <, >, >=, <=), followed by a text value;\n or the \"substring\" operator, followed by a text value;\n or <predicate.contains_parameters>, followed by a list of comma separated strings;\n or the \"in\" operator for strings, followed by a list of comma separated strings;\n or <predicate.contains_parameters>, followed by a quote (\"), followed by a list of comma separated items in a contains near operator's value, followed by a colon (:), followed by the number of words separation argument in the contains near operator's value, followed by a quote (\");\n or <predicate.contains_parameters>, followed by a text value;\n or the \"in\" operator for dynamic lists, followed by a dynamic list key;\n or <predicate.contains_parameters>, followed by a dynamic list key."}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"hash":"145ea24a4d83a14ecb9077b831f14809","created_at":"2014-05-21 13:53:08","dpu":"0.1"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"dpu":0.1,"detail":{"contains":{"count":1,"dpu":0.1,"targets":{"interaction.content":{"count":1,"dpu":0.1}}}}}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"created_at":1400772868,"id":"fbd5441ab17a46f2ac200f8cab6bdb79fe8efb31"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"id":"bba2e37958470b56d2a3d7748fd5ad918f7b8b92","name":"preview","progress":43,"status":"running","feeds":"facebook,twitter","sample":1,"end":1398985200,"created_at":1401293969,"start":1398898800,"user":"1","parameters":"language.tag,freqDist,5;interaction.id,targetVol,hour","hash":"145ea24a4d83a14ecb9077b831f14809"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"id":"bba2e37958470b56d2a3d7748fd5ad918f7b8b92","name":"preview","progress":100,"status":"succeeded","feeds":"facebook,twitter","sample":1,"end":1398985200,"created_at":1401293969,"start":1398898800,"user":"1","parameters":"language.tag,freqDist,5;interaction.id,targetVol,hour","hash":"145ea24a4d83a14ecb9077b831f14809","data":[{"target":"language.tag","analysis":"freqDist","output":{"fr":45,"id":49,"en":2720,"es":42,"ms":39},"threshold":5},{"target":"interaction.id","analysis":"targetVol","output":{"2014\/05\/01 21:00:00":108,"2014\/05\/01 08:00:00":76,"2014\/05\/01 09:00:00":204,"2014\/05\/01 12:00:00":133,"2014\/05\/01 00:00:00":118,"2014\/05\/01 18:00:00":104,"2014\/05\/01 06:00:00":90,"2014\/05\/01 02:00:00":181,"2014\/05\/01 03:00:00":119,"2014\/05\/01 22:00:00":105,"2014\/05\/01 15:00:00":162,"2014\/05\/01 07:00:00":95,"2014\/05\/01 05:00:00":87,"2014\/05\/01 14:00:00":137,"2014\/05\/01 10:00:00":124,"2014\/05\/01 20:00:00":99,"2014\/05\/01 01:00:00":154,"2014\/05\/01 17:00:00":131,"2014\/05\/01 04:00:00":142,"2014\/05\/01 11:00:00":101,"2014\/05\/01 19:00:00":105,"2014\/05\/01 16:00:00":161,"2014\/05\/01 13:00:00":158,"2014\/04\/30 23:00:00":116},"interval":"hour","summary":{"count":3010}}]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"id":"ca7f50126a9e7e837c8b716ac5f7604a","output_type":"http","name":"connectorhttp","created_at":1401295443,"user_id":1,"hash":"145ea24a4d83a14ecb9077b831f14809","hash_type":"stream","output_params":{"method":"post","url":"http:\/\/example.com\/datasift","compression":"none","delivery_frequency":0,"max_size":10485760,"verify_ssl":"false"},"status":"active","last_request":null,"last_success":null,"remaining_bytes":null,"lost_data":false,"start":1401295443,"end":0}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"subscriptions":[{"id":"7802b84cfe79e50e0a6e3cdac5ce54ab","output_type":"http","name":"connectorhttp","created_at":1401364070,"user_id":1,"hash":"145ea24a4d83a14ecb9077b831f14809","hash_type":"stream","output_params":{"method":"post","url":"http:\/\/example.com\/datasift","compression":"none","delivery_frequency":0,"max_size":10485760,"verify_ssl":"false"},"status":"active","last_request":1401381810,"last_success":1401381810,"remaining_bytes":null,"lost_data":false,"start":1401364070,"end":null}],"count":1}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"subscriptions":[{"id":"c0d390b3ad76e8d4a977e7c91364688f","output_type":"ftp","name":"Example","created_at":1401866981,"user_id":1,"hash":"5f569d6f99002bfaa483","hash_type":"historic","output_params":{"format":"json_meta","directory":"\/data","port":21,"max_size":10485760,"delivery_frequency":10,"host":"example.datasift.com"},"status":"finished","last_request":null,"last_success":1401870290,"remaining_bytes":null,"lost_data":false,"start":1401866981,"end":1401875424}],"count":1}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"subscriptions":[{"id":"7802b84cfe79e50e0a6e3cdac5ce54ab","output_type":"http","name":"connectorhttp","created_at":1401364070,"user_id":1,"hash":"145ea24a4d83a14ecb9077b831f14809","hash_type":"stream","output_params":{"method":"post","url":"http:\/\/example.com\/datasift","compression":"none","delivery_frequency":0,"max_size":10485760,"verify_ssl":"false"},"status":"active","last_request":null,"last_success":null,"remaining_bytes":null,"lost_data":false,"start":1401364070,"end":null}],"count":1}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"id":"ca7f50126a9e7e837c8b716ac5f7604a","output_type":"http","name":"connectorhttp","created_at":1401295443,"user_id":1,"hash":"145ea24a4d83a14ecb9077b831f14809","hash_type":"stream","output_params":{"method":"post","url":"http:\/\/example.com\/datasift","compression":"none","delivery_frequency":0,"max_size":10485760,"verify_ssl":"false"},"status":"active","last_request":null,"last_success":1401295476,"remaining_bytes":0,"lost_data":false,"start":1401295443,"end":null}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"success":true,"count":1,"log_entries":[{"request_time":1402413172,"success":true,"subscription_id":"7802b84cfe79e50e0a6e3cdac5ce54ab","message":"Successfully delivered after delivery failure(s)"}]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"id":"ca7f50126a9e7e837c8b716ac5f7604a","output_type":"http","name":"connectorhttp","created_at":1401295443,"user_id":1,"hash":"145ea24a4d83a14ecb9077b831f14809","hash_type":"stream","output_params":{"method":"post","url":"http:\/\/example.com\/datasift","compression":"none","delivery_frequency":0,"max_size":10485760,"verify_ssl":"false"},"status":"paused","last_request":null,"last_success":1401295476,"remaining_bytes":0,"lost_data":false,"start":1401295443,"end":null}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"id":"7802b84cfe79e50e0a6e3cdac5ce54ab","output_type":"http","name":"connectorhttp","created_at":1401364070,"user_id":1,"hash":"145ea24a4d83a14ecb9077b831f14809","hash_type":"stream","output_params":{"method":"post","url":"http:\/\/example.com\/datasift","compression":"none","delivery_frequency":0,"max_size":10485760,"verify_ssl":"false"},"status":"finishing","last_request":1401451186,"last_success":1401451181,"remaining_bytes":null,"lost_data":false,"start":1401364070,"end":1401451186}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"success":true,"message":"Validated successfully"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"start":"Wed, 21 May 2014 10:00:00 +0000","end":"Wed, 21 May 2014 11:00:00 +0000","streams":{"028eaeff74f186a768cc37107378fb9d":{"licenses":{"gender":2255,"interaction":2753,"klout.score":2155,"language":2677,"links":2723,"salience.sentiment":2663,"trends":44,"twitter":2753},"seconds":3600},"0fc46cdc3afbeb7c903ba5cb2ae73781":{"licenses":[],"seconds":3600},"1561e183f191f9aa0e55cda127a1e80d":{"licenses":[],"seconds":300},"49ab3b3aadf32fb81624ae69b4fa6646":{"licenses":{"facebook_page":1,"gender":1,"instagram":1,"interaction":1,"language":1,"salience.sentiment":1},"seconds":3600},"828dd0f10a8f7d0201c54684390d059d":{"licenses":[],"seconds":3600},"9dbf78769d088c868836a5d4861b9e7a":{"licenses":[],"seconds":300}}}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"error": "The target interaction.nonsense does not exist"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"created_at": "2014-01-30 10:09:19","dpu": "0.1"}
|