trend 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a83763d819e0962a0c4c7ca0cb0f5af76852be87becd30bbd341b12246a7510b
4
- data.tar.gz: ed4b4e58dc20df46dfdb7d252f4dcf680494bb38b901301c002a5a309f840344
3
+ metadata.gz: 127d317059995d6c5ef713438f3c3ccbd61cac529a74fd9481a34f5429ecc59a
4
+ data.tar.gz: ee6f4c72cb63f2582f41ec5efb82920fae6158ec87b31c84bc09fd83f1170de0
5
5
  SHA512:
6
- metadata.gz: 042cd0604e706892b96009608827b6ec4cc14336d20d15779de0f6c0bb05bace81b16691d1c78168449041efe1a308c4fccc46ac9ef7b8ff98a44f4ecaa948b6
7
- data.tar.gz: dd854dc3931e03260eb236fe7d40f7f3da2cb830676472e0d5a9d48c568274e0dae40b47b208cba31dba70e45e2bf503e353eb746283162eca6d3ebeaf566f6c
6
+ metadata.gz: b081882f557cfa7a9e27b55764d74afc9cb8c4692eb1e5aac45f7b86cf879d820f9585a9d31150087e443b7a4cd6455c358ae6200947352e9720b698396334a6
7
+ data.tar.gz: 26e63588c546ef8fe71c6959ac63feaeb57989309e5f4f0b003ed40c12c535b8bbc832cc9f072e430cd38a2a920bce0c7b965890be73a54f3e49d11989679d94
@@ -1,3 +1,8 @@
1
+ ## 0.1.2
2
+
3
+ - Extended timeout
4
+ - Added `timeout` option
5
+
1
6
  ## 0.1.1
2
7
 
3
8
  - Added support for API keys
data/README.md CHANGED
@@ -4,7 +4,7 @@ Ruby client for [Trend](https://trendapi.org), the anomaly detection and forecas
4
4
 
5
5
  [![Build Status](https://travis-ci.org/ankane/trend.svg?branch=master)](https://travis-ci.org/ankane/trend)
6
6
 
7
- ## Getting Started
7
+ ## Installation
8
8
 
9
9
  Add this line to your application’s Gemfile:
10
10
 
@@ -12,7 +12,7 @@ Add this line to your application’s Gemfile:
12
12
  gem 'trend'
13
13
  ```
14
14
 
15
- ### Anomaly Detection
15
+ ## Anomaly Detection
16
16
 
17
17
  Detect anomalies in a time series
18
18
 
@@ -38,7 +38,7 @@ series = User.group_by_day(:created_at).count
38
38
  Trend.anomalies(series)
39
39
  ```
40
40
 
41
- ### Forecasting
41
+ ## Forecasting
42
42
 
43
43
  Get future predictions for a time series
44
44
 
@@ -66,7 +66,7 @@ Specify the number of predictions to return
66
66
  Trend.forecast(series, count: 3)
67
67
  ```
68
68
 
69
- ### Correlation [experimental]
69
+ ## Correlation [experimental]
70
70
 
71
71
  Get the correlation between two time series
72
72
 
@@ -76,7 +76,7 @@ Trend.correlation(series, series2)
76
76
 
77
77
  ## Authentication
78
78
 
79
- An API key is needed for more than 1000 requests per day per IP. [Email us](mailto:hi@trendapi.org) to get one.
79
+ An API key is needed for more than 1,000 requests per day per IP. [Email us](mailto:hi@trendapi.org) to get one.
80
80
 
81
81
  If you have one, set `ENV["TREND_API_KEY"]` or use:
82
82
 
@@ -8,13 +8,13 @@ module Trend
8
8
  "User-Agent" => "trend-ruby/#{Trend::VERSION}"
9
9
  }
10
10
 
11
- def initialize(url: nil, api_key: nil)
11
+ def initialize(url: nil, api_key: nil, timeout: 30)
12
12
  @api_key = api_key || Trend.api_key
13
13
  @uri = URI.parse(url || Trend.url)
14
14
  @http = Net::HTTP.new(@uri.host, @uri.port)
15
15
  @http.use_ssl = true if @uri.scheme == "https"
16
- @http.open_timeout = 3
17
- @http.read_timeout = 5
16
+ @http.open_timeout = timeout
17
+ @http.read_timeout = timeout
18
18
  end
19
19
 
20
20
  def anomalies(series, params = {})
@@ -1,3 +1,3 @@
1
1
  module Trend
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2019-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -67,23 +67,17 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description:
70
- email:
71
- - andrew@chartkick.com
70
+ email: andrew@chartkick.com
72
71
  executables: []
73
72
  extensions: []
74
73
  extra_rdoc_files: []
75
74
  files:
76
- - ".gitignore"
77
- - ".travis.yml"
78
75
  - CHANGELOG.md
79
- - Gemfile
80
76
  - LICENSE.txt
81
77
  - README.md
82
- - Rakefile
83
78
  - lib/trend.rb
84
79
  - lib/trend/client.rb
85
80
  - lib/trend/version.rb
86
- - trend.gemspec
87
81
  homepage: https://github.com/ankane/trend
88
82
  licenses:
89
83
  - MIT
@@ -96,15 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
90
  requirements:
97
91
  - - ">="
98
92
  - !ruby/object:Gem::Version
99
- version: '0'
93
+ version: '2.2'
100
94
  required_rubygems_version: !ruby/object:Gem::Requirement
101
95
  requirements:
102
96
  - - ">="
103
97
  - !ruby/object:Gem::Version
104
98
  version: '0'
105
99
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.7.7
100
+ rubygems_version: 3.0.3
108
101
  signing_key:
109
102
  specification_version: 4
110
103
  summary: Ruby client for Trend, the time series API
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- *.lock
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm: 2.5.1
3
- gemfile:
4
- - Gemfile
5
- sudo: false
6
- before_install: gem install bundler
7
- script: bundle exec rake test
8
- notifications:
9
- email:
10
- on_success: never
11
- on_failure: change
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in trend.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
11
-
12
- task :benchmark do
13
- require "benchmark/ips"
14
- require "trend"
15
-
16
- series = {}
17
- date = Date.parse("2018-01-01")
18
- 1000.times do
19
- series[date] = rand(100)
20
- date += 1
21
- end
22
-
23
- Trend.url = "http://localhost:8000"
24
-
25
- Benchmark.ips do |x|
26
- x.report("anomalies") { Trend.anomalies(series) }
27
- x.report("forecast") { Trend.forecast(series) }
28
- end
29
- end
@@ -1,29 +0,0 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "trend/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "trend"
8
- spec.version = Trend::VERSION
9
- spec.authors = ["Andrew Kane"]
10
- spec.email = ["andrew@chartkick.com"]
11
-
12
- spec.summary = "Ruby client for Trend, the time series API"
13
- spec.homepage = "https://github.com/ankane/trend"
14
- spec.license = "MIT"
15
-
16
- # Specify which files should be added to the gem when it is released.
17
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- end
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ["lib"]
24
-
25
- spec.add_development_dependency "benchmark-ips"
26
- spec.add_development_dependency "bundler"
27
- spec.add_development_dependency "rake"
28
- spec.add_development_dependency "minitest"
29
- end