datasift 3.1.5 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -2
  3. data/.yardopts +4 -0
  4. data/CHANGELOG.md +23 -0
  5. data/Gemfile +13 -0
  6. data/README.md +17 -16
  7. data/VERSION +1 -1
  8. data/datasift.gemspec +8 -14
  9. data/examples/account_identity_eg.rb +48 -0
  10. data/examples/account_identity_limit_eg.rb +68 -0
  11. data/examples/account_identity_token_eg.rb +70 -0
  12. data/examples/auth.rb +4 -4
  13. data/examples/core_api_eg.rb +1 -2
  14. data/examples/historics_eg.rb +7 -1
  15. data/examples/pylon_eg.rb +116 -0
  16. data/lib/account.rb +6 -0
  17. data/lib/account_identity.rb +73 -0
  18. data/lib/account_identity_limit.rb +85 -0
  19. data/lib/account_identity_token.rb +86 -0
  20. data/lib/api/api_resource.rb +14 -5
  21. data/lib/cli.rb +306 -132
  22. data/lib/datasift.rb +82 -47
  23. data/lib/errors.rb +21 -5
  24. data/lib/historics.rb +71 -40
  25. data/lib/historics_preview.rb +25 -8
  26. data/lib/managed_source.rb +69 -25
  27. data/lib/managed_source_auth.rb +21 -6
  28. data/lib/managed_source_resource.rb +21 -6
  29. data/lib/push.rb +132 -65
  30. data/lib/pylon.rb +122 -0
  31. data/test/datasift/core_api_test.rb +116 -90
  32. data/test/datasift/historics_preview_api_test.rb +27 -58
  33. data/test/datasift/push_api_test.rb +156 -141
  34. data/test/fixtures/cassettes/core/after_historic_dpu.json +1 -0
  35. data/test/fixtures/cassettes/core/balance_get.json +1 -0
  36. data/test/fixtures/cassettes/core/before_dpu.json +1 -0
  37. data/test/fixtures/cassettes/core/before_historic_dpu.json +1 -0
  38. data/test/fixtures/cassettes/core/compile_success.json +1 -0
  39. data/test/fixtures/cassettes/core/dpu_get_cost.json +1 -0
  40. data/test/fixtures/cassettes/core/dpu_throw_badrequest.json +1 -0
  41. data/test/fixtures/cassettes/core/historic_dpu.json +1 -0
  42. data/test/fixtures/cassettes/core/usage_success.json +1 -0
  43. data/test/fixtures/cassettes/core/validate_invalid_hash.json +1 -0
  44. data/test/fixtures/cassettes/core/validate_success_bool.json +1 -0
  45. data/test/fixtures/cassettes/core/validate_success_hash.json +1 -0
  46. data/test/fixtures/cassettes/preview/before_preview_create.json +1 -0
  47. data/test/fixtures/cassettes/preview/before_preview_get.json +1 -0
  48. data/test/fixtures/cassettes/preview/preview_create_success.json +1 -0
  49. data/test/fixtures/cassettes/preview/preview_get_success.json +1 -0
  50. data/test/fixtures/cassettes/push/after_push_create.json +1 -0
  51. data/test/fixtures/cassettes/push/after_push_get.json +1 -0
  52. data/test/fixtures/cassettes/push/after_push_log.json +1 -0
  53. data/test/fixtures/cassettes/push/after_push_pause.json +1 -0
  54. data/test/fixtures/cassettes/push/after_push_resume.json +1 -0
  55. data/test/fixtures/cassettes/push/after_push_stop.json +1 -0
  56. data/test/fixtures/cassettes/push/after_push_update.json +1 -0
  57. data/test/fixtures/cassettes/push/before_push_create.json +1 -0
  58. data/test/fixtures/cassettes/push/before_push_delete.json +1 -0
  59. data/test/fixtures/cassettes/push/before_push_get.json +1 -0
  60. data/test/fixtures/cassettes/push/before_push_log.json +1 -0
  61. data/test/fixtures/cassettes/push/before_push_pause.json +1 -0
  62. data/test/fixtures/cassettes/push/before_push_resume.json +1 -0
  63. data/test/fixtures/cassettes/push/before_push_stop.json +1 -0
  64. data/test/fixtures/cassettes/push/before_push_update.json +1 -0
  65. data/test/fixtures/cassettes/push/push_create.json +1 -0
  66. data/test/fixtures/cassettes/push/push_delete.json +1 -0
  67. data/test/fixtures/cassettes/push/push_get_by_id.json +1 -0
  68. data/test/fixtures/cassettes/push/push_log_with_id.json +1 -0
  69. data/test/fixtures/cassettes/push/push_pause.json +1 -0
  70. data/test/fixtures/cassettes/push/push_resume.json +1 -0
  71. data/test/fixtures/cassettes/push/push_stop.json +1 -0
  72. data/test/fixtures/cassettes/push/push_update.json +1 -0
  73. data/test/fixtures/cassettes/push/push_validate.json +1 -0
  74. data/test/test_helper.rb +31 -1
  75. metadata +64 -104
  76. data/examples/dynamic_list_eg.rb +0 -74
  77. data/examples/dynamic_list_replace_eg.rb +0 -45
  78. data/lib/dynamic_list.rb +0 -66
  79. data/lib/dynamic_list_replace.rb +0 -45
  80. data/test/fixtures/balance.json +0 -1
  81. data/test/fixtures/compile_csdl_invalid.json +0 -1
  82. data/test/fixtures/compile_csdl_valid.json +0 -1
  83. data/test/fixtures/dpu_valid.json +0 -1
  84. data/test/fixtures/preview_create_valid.json +0 -1
  85. data/test/fixtures/preview_get_running.json +0 -1
  86. data/test/fixtures/preview_get_succeeded.json +0 -1
  87. data/test/fixtures/push_create_valid.json +0 -1
  88. data/test/fixtures/push_get_list_by_hash_valid.json +0 -1
  89. data/test/fixtures/push_get_list_by_historics_id_valid.json +0 -1
  90. data/test/fixtures/push_get_list_valid.json +0 -1
  91. data/test/fixtures/push_get_valid.json +0 -1
  92. data/test/fixtures/push_log_valid.json +0 -1
  93. data/test/fixtures/push_pause_valid.json +0 -1
  94. data/test/fixtures/push_stop_valid.json +0 -1
  95. data/test/fixtures/push_validate_valid.json +0 -1
  96. data/test/fixtures/usage_current.json +0 -1
  97. data/test/fixtures/validate_csdl_invalid.json +0 -1
  98. data/test/fixtures/validate_csdl_valid.json +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e26c08e631f867f85ab95045922077db5b67e1c
4
- data.tar.gz: 93187c60a79ee54862d6cb535903c722dcfd1aff
3
+ metadata.gz: c6c428274cf28d80ef439f0ca06a5a247cf70140
4
+ data.tar.gz: dc0df1b7d90456facf9cdc193ee69a2ebd5ab210
5
5
  SHA512:
6
- metadata.gz: 6924f398475a57823c4dcaa1a5ccf08ac0504b19b2b0b15c88243ad1ee8e6888c0ba0c49dec3dc6dc579429d03cbd7bf1bdf475ac3ad2230a077b15260f2deac
7
- data.tar.gz: dd038e17916e0416fbd6b0484fb32f5386925e45ddde4e73c414b69279c6d45612825b29cbf4e34764064aab560e09fe8dffddbb1875e25a55a61db44e0bc870
6
+ metadata.gz: c150becbafbc9ddf74a49b482bd2b83f93b67595701779c7383c6232b78739099982f1e4cdd6170b0fe8b13b05ef28c01ab96e28b709d8f31fd399dd12e04956
7
+ data.tar.gz: 9188cf1a6dead964bfee1a77ea8d3ecad37e4261af29eab15e505c7f51d9a0b4d7998aee69eae75f141670eed02bfd55459f8e28460e047d1314628a13f189e4
data/.gitignore CHANGED
@@ -2,10 +2,11 @@
2
2
  sftp-config.json
3
3
  *.iml
4
4
  .idea/
5
- rdoc/
6
5
  .bundle/
7
6
  Gemfile.lock
8
- coverage/*
7
+ coverage/
9
8
  TODO
10
9
  pkg/*
11
10
  *.gem
11
+ .yardoc
12
+ doc/
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --no-private
2
+ --protected
3
+ lib/**/*.rb
4
+ -
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  CHANGELOG
2
2
  ================================
3
+ ## v.3.2.0 (2015-05-13)
4
+ ### Added
5
+ * Support for [PYLON API](http://dev.datasift.com/pylon/docs/api-endpoints)
6
+ * Support for [Account Identities API](http://dev.datasift.com/pylon/docs/api/account-api)
7
+ * Adds opts for Managed Sources create/update endpoints to allow passing of 'validate' param
8
+ * Support for HTTP 409 Conflict error
9
+ * Support for HTTP 410 Gone error
10
+ * Comprehensive Yard Docs for all classes and methods
11
+ * Due to API v1.1 change, we've added support for ```include_finished``` and ```all``` parameters when making calls to the ```/push/get``` API endpoint
12
+ * Due to the API v1.1 change, a ```delivery_count``` field has been added to the main object, and individual chunks in the response from ```/historics/get``` calls
13
+ * Due to the API v1.1 change, an ```interaction_count``` field has been added to the respomse from ```/push/get``` API calls
14
+ * The ```dpu()``` method now also accepts the ```historics_id``` parameter, which allows you to get the DPU cost of an Historics query
15
+
16
+ ### Changed
17
+ * Some refactoring for the Rubocop across the library
18
+ * We now use [VCR](https://github.com/vcr/vcr) in our test suite for all outbound API calls
19
+ * Updated some methods due to deprecations in the Ruby language
20
+ * Use DataSift API v1.1 by default
21
+ * Due to the API v1.1 change, /usage and /balance API calls will now return an empty Object rather than an empy Array when there is no data available
22
+
23
+ ### Deprecated
24
+ * Support for Ruby 1.x is being dropped in the next major release; 4.0.0
25
+ * Due to the API v1.1 change, the ```volume_info``` field has been removed from ```/historics/get``` API calls
3
26
 
4
27
  v.3.1.5 (2015-04-16)
5
28
  --------------------
data/Gemfile CHANGED
@@ -1,2 +1,15 @@
1
1
  source "https://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gem 'yard'
5
+
6
+ group :test do
7
+ gem 'minitest', '~> 5.0'
8
+ gem 'rubocop', '>= 0.27'
9
+ gem 'simplecov', '>= 0.9'
10
+ gem 'shoulda', '~> 2.11'
11
+ gem 'vcr', '~> 2.9'
12
+ gem 'webmock'
13
+ end
14
+
2
15
  gemspec
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  DataSift
2
2
  ========
3
-
4
3
  [![Gem Version](http://img.shields.io/gem/v/datasift.svg)][gem]
5
4
  [![Build Status](http://img.shields.io/travis/datasift/datasift-ruby.svg)][travis]
6
5
 
@@ -12,7 +11,6 @@ The official Ruby library for accessing the DataSift API.
12
11
 
13
12
  Getting Started
14
13
  ---------------
15
-
16
14
  **Read our [Ruby Getting Started Guide](http://dev.datasift.com/quickstart/ruby) to get started with the DataSift platform.** The guide will take you through creating a [DataSift](http://datasift.com) account, and activating data sources which you will need to do before using the DataSift API.
17
15
 
18
16
  Many of the examples and API endpoints used in this library require you have enabled certain data sources before you can receive any data (you should do this at [datasift.com/source](https://datasift.com/source)). Certain API features, such as [Historics](http://datasift.com/platform/historics/) and [Managed Sources](http://datasift.com/platform/datasources/) will require you have signed up to a monthly subscription before you can access them.
@@ -22,14 +20,12 @@ If you are interested in using these features, or would like more information ab
22
20
 
23
21
  Install Instructions
24
22
  --------------------
25
-
26
23
  ```
27
24
  sudo gem install datasift
28
25
  ```
29
26
 
30
27
  Dependencies
31
28
  ------------
32
-
33
29
  If you're using the source you'll need to install the dependencies.
34
30
 
35
31
  ```
@@ -37,19 +33,18 @@ sudo gem install rest-client multi_json websocket-td
37
33
  ```
38
34
 
39
35
  The library will use SSL connections by default. While we recommend using SSL
40
- you may disable it if required by passing ':enable_ssl => false' as the third
41
- parameter when creating your @config object.
36
+ you may disable it if required by passing ```enable_ssl: false``` as the third
37
+ parameter when creating your ```@config``` object.
42
38
 
43
39
 
44
40
  Simple example
45
41
  --------------
46
-
47
42
  This example looks for anything that contains the word "football" in real-time,
48
43
  and simply prints the content to the screen as they come in.
49
44
 
50
45
  ```ruby
51
46
  require 'datasift'
52
- @config = {:username => 'DATASIFT_USERNAME', :api_key => 'DATASIFT_API_KEY', :enable_ssl => true}
47
+ @config = { username: 'DATASIFT_USERNAME', api_key: 'DATASIFT_API_KEY' }
53
48
  @datasift = DataSift::Client.new(@config)
54
49
  csdl = 'interaction.content contains "football"'
55
50
  filter = @datasift.compile csdl
@@ -83,16 +78,13 @@ conn.on_datasift_message = on_datasift_message
83
78
  conn.stream.read_thread.join
84
79
  ```
85
80
 
86
- See the [Understanding the Output Data](http://dev.datasift.com/docs/getting-started/data) page on the DataSift Developer site for
87
- full details of the data contained within each interaction.
88
-
89
81
  Supported Operating Environment
90
82
  -------------------------------
91
83
  This version of the client library has been tested, and is known to work against the following language versions and Operating Systems:
92
84
 
93
85
  ### Language Versions
94
- * Ruby 1.9.3 (Seems to work, but NOT officially supported/thoroughly tested)
95
- * Ruby 2.0.0
86
+ * Ruby 1.9.3 (Support for Ruby 1.x will be dropped from v4.0 of the library)
87
+ * Ruby 2.0
96
88
  * Ruby 2.1
97
89
  * Ruby 2.2
98
90
 
@@ -102,10 +94,19 @@ This version of the client library has been tested, and is known to work against
102
94
  * OS X
103
95
  * Windows 7/8
104
96
 
97
+ Contributing
98
+ ------------
99
+ Contributions are always welcome and appreciated
100
+
101
+ 1. Fork on GitHub
102
+ 2. Create a feature branch (we use [Gitflow](http://datasift.github.io/gitflow/IntroducingGitFlow.html) for branching)
103
+ 3. Commit your changes with tests
104
+ * New feature? Send a pull request against the develop branch.
105
+ * Bug fix? Send a pull request against the master branch.
106
+ * Please don't break backwards-compatibility :)
107
+
105
108
  License
106
109
  -------
107
-
108
110
  All code contained in this repository is Copyright 2011-2015 MediaSift Ltd.
109
111
 
110
- This code is released under the BSD license. Please see the [LICENSE](https://github.com/datasift/datasift-ruby/blob/master/LICENSE) file for
111
- more details.
112
+ This code is released under the BSD license. Please see the [LICENSE](https://github.com/datasift/datasift-ruby/blob/master/LICENSE) file for more details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.5
1
+ 3.2.0
data/datasift.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'datasift'
3
3
  s.version = File.open('VERSION').first
4
- s.authors = ['DataSift']
4
+ s.authors = ['DataSift', 'Courtney Robinson', 'Jason Dugdale']
5
5
  s.email = ['support@datasift.com']
6
6
  s.description = %q{The official Ruby library for accessing the DataSift API. See http://datasift.com/ for full details and to sign up for an account.}
7
7
  s.summary = %q{DataSift is a simple wrapper for the DataSift API.}
@@ -9,20 +9,14 @@ Gem::Specification.new do |s|
9
9
  s.license = 'BSD'
10
10
 
11
11
  s.platform = Gem::Platform::RUBY
12
- s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
13
-
14
- s.add_runtime_dependency('rest-client', '~> 1.6')
15
- s.add_runtime_dependency('multi_json', '>= 1.7')
16
- s.add_runtime_dependency('websocket-td', '~> 0.0.4')
17
-
18
- s.add_development_dependency('rdoc', '>= 0')
19
- s.add_development_dependency('webmock', '~> 1.17')
20
- s.add_development_dependency('shoulda', '~> 2.11')
21
- s.add_development_dependency('minitest', '~> 5.0')
22
- s.add_development_dependency('rake', '>= 0')
23
- s.add_development_dependency('simplecov', '>= 0')
24
-
12
+ s.required_rubygems_version = '>= 1.3.5'
13
+ s.required_ruby_version = '>= 2.0.0'
25
14
  s.files = `git ls-files`.split("\n")
26
15
  s.test_files = `git ls-files -- {test}/*`.split("\n")
27
16
  s.require_paths = ["lib"]
17
+
18
+ s.add_runtime_dependency('rest-client', '~> 1.6')
19
+ s.add_runtime_dependency('multi_json', '~> 1.7')
20
+ s.add_runtime_dependency('websocket-td', '~> 0.0.5')
21
+ s.add_development_dependency('bundler', '~> 1.0')
28
22
  end
@@ -0,0 +1,48 @@
1
+ require './auth'
2
+ class AccountIdentityEg < DataSiftExample
3
+ def initialize
4
+ super
5
+ @datasift = DataSift::Client.new(@config)
6
+ run
7
+ end
8
+
9
+ def run
10
+ begin
11
+ puts "Create a new identity"
12
+ identity = @datasift.account_identity.create(
13
+ "Ruby Identity", "active", false
14
+ )
15
+ identity_id = identity[:data][:id]
16
+ puts identity.to_json
17
+
18
+ puts "\nList all existing identities"
19
+ puts @datasift.account_identity.list.to_json
20
+
21
+ puts "\nGet existing identity"
22
+ puts @datasift.account_identity.get(identity_id).to_json
23
+
24
+ puts "\nUpdate an identity"
25
+ puts @datasift.account_identity.update(
26
+ identity_id, 'Updated Ruby Identity'
27
+ ).to_json
28
+
29
+ puts "\nDelete an identity"
30
+ puts @datasift.account_identity.delete(identity_id).to_json
31
+
32
+ rescue DataSiftError => dse
33
+ puts dse.message
34
+ # Then match specific error to take action;
35
+ # All errors thrown by the client extend DataSiftError
36
+ case dse
37
+ when ConnectionError
38
+ # some connection error
39
+ when AuthError
40
+ when BadRequestError
41
+ else
42
+ # do something else...
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ AccountIdentityEg.new
@@ -0,0 +1,68 @@
1
+ require './auth'
2
+ class AccountIdentityLimitEg < DataSiftExample
3
+ def initialize
4
+ super
5
+ @datasift = DataSift::Client.new(@config)
6
+ run
7
+ end
8
+
9
+ def run
10
+ begin
11
+ puts "Create a new identity to apply Limits to"
12
+ identity = @datasift.account_identity.create(
13
+ "Ruby Identity for Token Limits", "active", false
14
+ )
15
+ identity_id = identity[:data][:id]
16
+ puts identity.to_json
17
+
18
+ puts "\nCreate a Limit for our Identity"
19
+ puts @datasift.account_identity_limit.create(
20
+ identity_id,
21
+ 'facebook',
22
+ 100_000
23
+ )
24
+
25
+ puts "\nList all existing Limits for this Service"
26
+ puts @datasift.account_identity_limit.list(
27
+ 'facebook'
28
+ ).to_json
29
+
30
+ puts "\nGet existing Limit by Identity and Service"
31
+ puts @datasift.account_identity_limit.get(
32
+ identity_id,
33
+ 'facebook'
34
+ ).to_json
35
+
36
+ puts "\nUpdate a Limit for a given Identity"
37
+ puts @datasift.account_identity_limit.update(
38
+ identity_id,
39
+ 'facebook',
40
+ 250_000
41
+ ).to_json
42
+
43
+ puts "\nRemove the Limit from a given Identity and Service"
44
+ puts @datasift.account_identity_limit.delete(
45
+ identity_id,
46
+ 'facebook'
47
+ ).to_json
48
+
49
+ puts "\nCleanup and remove the Identity"
50
+ @datasift.account_identity.delete(identity_id)
51
+
52
+ rescue DataSiftError => dse
53
+ puts dse.message
54
+ # Then match specific error to take action;
55
+ # All errors thrown by the client extend DataSiftError
56
+ case dse
57
+ when ConnectionError
58
+ # some connection error
59
+ when AuthError
60
+ when BadRequestError
61
+ else
62
+ # do something else...
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ AccountIdentityLimitEg.new
@@ -0,0 +1,70 @@
1
+ require './auth'
2
+ class AccountIdentityTokenEg < DataSiftExample
3
+ def initialize
4
+ super
5
+ @datasift = DataSift::Client.new(@config)
6
+ run
7
+ end
8
+
9
+ def run
10
+ begin
11
+ puts "Create a new identity to create tokens for"
12
+ identity = @datasift.account_identity.create(
13
+ "Ruby Identity for Tokens",
14
+ "active",
15
+ false
16
+ )
17
+ identity_id = identity[:data][:id]
18
+ puts identity.to_json
19
+
20
+ puts "\nCreate a Token for our Identity"
21
+ puts @datasift.account_identity_token.create(
22
+ identity_id,
23
+ 'facebook',
24
+ 'YOUR_TOKEN'
25
+ )
26
+
27
+ puts "\nList all existing Tokens for this Identity"
28
+ puts @datasift.account_identity_token.list(
29
+ identity_id
30
+ ).to_json
31
+
32
+ puts "\nGet existing Token by Identity and Service"
33
+ puts @datasift.account_identity_token.get(
34
+ identity_id,
35
+ 'facebook'
36
+ ).to_json
37
+
38
+ puts "\nUpdate a Token for a given Identity"
39
+ puts @datasift.account_identity_token.update(
40
+ identity_id,
41
+ 'facebook',
42
+ 'YOUR_NEW_TOKEN'
43
+ ).to_json
44
+
45
+ puts "\nDelete an Token for a given Identity and Service"
46
+ puts @datasift.account_identity_token.delete(
47
+ identity_id,
48
+ 'facebook'
49
+ ).to_json
50
+
51
+ puts "\nCleanup and remove the Identity"
52
+ @datasift.account_identity.delete(identity_id)
53
+
54
+ rescue DataSiftError => dse
55
+ puts dse.message
56
+ # Then match specific error to take action;
57
+ # All errors thrown by the client extend DataSiftError
58
+ case dse
59
+ when ConnectionError
60
+ # some connection error
61
+ when AuthError
62
+ when BadRequestError
63
+ else
64
+ # do something else...
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ AccountIdentityTokenEg.new
data/examples/auth.rb CHANGED
@@ -3,9 +3,9 @@ class DataSiftExample
3
3
 
4
4
  def initialize
5
5
  @username = 'DATASIFT_USERNAME'
6
- @api_key = 'DATASIFT_API_KEY'
7
- @config = {:username => @username, :api_key => @api_key, :enable_ssl => true}
8
- @params = {
6
+ @api_key = 'DATASIFT_API_KEY'
7
+ @config = { :username => @username, :api_key => @api_key }
8
+ @params = {
9
9
  :output_type => 's3',
10
10
  :output_params => {
11
11
  :bucket => 'YOUR_BUCKET_NAME',
@@ -29,7 +29,7 @@ class DataSiftExample
29
29
  @datasift = DataSift::Client.new(@config)
30
30
  end
31
31
 
32
- attr_reader :datasift
32
+ attr_reader :datasift, :params
33
33
 
34
34
  def create_push(hash, is_historics_id = false)
35
35
  create_params = @params.merge ({
@@ -16,7 +16,7 @@ class CoreApiEg < DataSiftExample
16
16
  # http://dev.datasift.com/docs/rest-api/compile
17
17
  puts "\nCompile the CSDL and get a stream hash"
18
18
  stream = @datasift.compile csdl
19
- puts stream[:data][:hash]
19
+ puts stream[:data]
20
20
 
21
21
  # http://dev.datasift.com/docs/rest-api/dpu
22
22
  puts "\nGet the DPU cost of the compiled CSDL"
@@ -33,7 +33,6 @@ class CoreApiEg < DataSiftExample
33
33
  usage = @datasift.usage
34
34
  puts usage[:data]
35
35
 
36
- #rescue DataSiftError
37
36
  rescue DataSiftError => dse
38
37
  puts dse.message
39
38
  # Then match specific one to take action - All errors thrown by the client extend DataSiftError
@@ -22,8 +22,11 @@ class HistoricsApi < DataSiftExample
22
22
 
23
23
  id = historics[:data][:id]
24
24
 
25
+ puts "\nCheck the DPU cost of this Historics query"
26
+ puts "#{@datasift.dpu('', id)[:data][:dpu]} DPUs"
27
+
25
28
  puts "\nCreating push subscription for historics"
26
- puts create_push(id, true)
29
+ subscription = create_push(id, true)
27
30
 
28
31
  puts "\nStarting historics #{id}"
29
32
  puts @datasift.historics.start id
@@ -48,6 +51,9 @@ class HistoricsApi < DataSiftExample
48
51
 
49
52
  puts "\nDeleting historics"
50
53
  puts @datasift.historics.delete id
54
+
55
+ puts "\nCleanup and delete Push subscription"
56
+ puts @datasift.push.delete subscription[:data][:id]
51
57
  rescue DataSiftError => dse
52
58
  puts dse.message
53
59
  end