trend 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -3
- data/LICENSE.txt +1 -1
- data/README.md +19 -23
- data/lib/trend/version.rb +1 -1
- data/lib/trend.rb +4 -2
- metadata +11 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4aa1b64d52a9185046f567b304af2e75dfada027d6bc971325081b0b741c61
|
4
|
+
data.tar.gz: e5bcc34a35292c55f94d32959a54b7db3ad6ab8a450793bf8ae87a8e17cff9f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1771a5627ff3f99764f953c243052192d7d461d039553e559fdf49a57e30ec7fc52138e5d5ab37dd670d17916db300573c84045531233e3e64d1c4be3d2f658
|
7
|
+
data.tar.gz: c1618e0b0db4a942f161f6ba4b46de0e1efb64b85699d59bc54d77036dc0e02aff215f0863cfc19c2e1498880e629601d228d019612d38053c2d109fa37cc28d
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.2.0 (2023-05-03)
|
2
|
+
|
3
|
+
- Dropped support for Ruby < 3
|
4
|
+
|
5
|
+
## 0.1.2 (2019-04-10)
|
2
6
|
|
3
7
|
- Extended timeout
|
4
8
|
- Added `timeout` option
|
5
9
|
|
6
|
-
## 0.1.1
|
10
|
+
## 0.1.1 (2018-10-28)
|
7
11
|
|
8
12
|
- Added support for API keys
|
9
13
|
- Added experimental `correlation` method
|
10
14
|
|
11
|
-
## 0.1.0
|
15
|
+
## 0.1.0 (2018-05-23)
|
12
16
|
|
13
17
|
- First release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
-
# Trend
|
1
|
+
# Trend Ruby
|
2
2
|
|
3
3
|
Ruby client for [Trend](https://trendapi.org), the anomaly detection and forecasting API
|
4
4
|
|
5
|
-
[![Build Status](https://
|
5
|
+
[![Build Status](https://github.com/ankane/trend-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/trend-ruby/actions)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add this line to your application’s Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem
|
12
|
+
gem "trend"
|
13
|
+
```
|
14
|
+
|
15
|
+
For the [self-hosted API](https://github.com/ankane/trend-api), create an initializer with:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Trend.url = "http://localhost:8000"
|
13
19
|
```
|
14
20
|
|
15
21
|
## Anomaly Detection
|
@@ -19,7 +25,7 @@ Detect anomalies in a time series
|
|
19
25
|
```ruby
|
20
26
|
# generate series
|
21
27
|
series = {}
|
22
|
-
date = Date.parse("
|
28
|
+
date = Date.parse("2023-04-01")
|
23
29
|
28.times do
|
24
30
|
series[date] = rand(100)
|
25
31
|
date += 1
|
@@ -31,7 +37,7 @@ series[date - 8] = 999
|
|
31
37
|
Trend.anomalies(series)
|
32
38
|
```
|
33
39
|
|
34
|
-
Works great with
|
40
|
+
Works great with [Groupdate](https://github.com/ankane/groupdate)
|
35
41
|
|
36
42
|
```ruby
|
37
43
|
series = User.group_by_day(:created_at).count
|
@@ -44,7 +50,7 @@ Get future predictions for a time series
|
|
44
50
|
|
45
51
|
```ruby
|
46
52
|
series = {}
|
47
|
-
date = Date.parse("
|
53
|
+
date = Date.parse("2023-04-01")
|
48
54
|
28.times do
|
49
55
|
series[date] = date.wday
|
50
56
|
date += 1
|
@@ -74,34 +80,24 @@ Get the correlation between two time series
|
|
74
80
|
Trend.correlation(series, series2)
|
75
81
|
```
|
76
82
|
|
77
|
-
## Authentication
|
78
|
-
|
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
|
-
|
81
|
-
If you have one, set `ENV["TREND_API_KEY"]` or use:
|
82
|
-
|
83
|
-
```ruby
|
84
|
-
Trend.api_key = "secret"
|
85
|
-
```
|
86
|
-
|
87
83
|
## History
|
88
84
|
|
89
|
-
View the [changelog](https://github.com/ankane/trend/blob/master/CHANGELOG.md)
|
85
|
+
View the [changelog](https://github.com/ankane/trend-ruby/blob/master/CHANGELOG.md)
|
90
86
|
|
91
87
|
## Contributing
|
92
88
|
|
93
89
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
94
90
|
|
95
|
-
- [Report bugs](https://github.com/ankane/trend/issues)
|
96
|
-
- Fix bugs and [submit pull requests](https://github.com/ankane/trend/pulls)
|
91
|
+
- [Report bugs](https://github.com/ankane/trend-ruby/issues)
|
92
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/trend-ruby/pulls)
|
97
93
|
- Write, clarify, or fix documentation
|
98
94
|
- Suggest or add new features
|
99
95
|
|
100
|
-
To get started with development
|
96
|
+
To get started with development:
|
101
97
|
|
102
98
|
```sh
|
103
|
-
git clone https://github.com/ankane/trend.git
|
104
|
-
cd trend
|
99
|
+
git clone https://github.com/ankane/trend-ruby.git
|
100
|
+
cd trend-ruby
|
105
101
|
bundle install
|
106
|
-
rake test
|
102
|
+
bundle exec rake test
|
107
103
|
```
|
data/lib/trend/version.rb
CHANGED
data/lib/trend.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# stdlib
|
1
2
|
require "date"
|
2
3
|
require "json"
|
3
4
|
require "net/http"
|
4
5
|
require "time"
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
# modules
|
8
|
+
require_relative "trend/client"
|
9
|
+
require_relative "trend/version"
|
8
10
|
|
9
11
|
module Trend
|
10
12
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,73 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
description:
|
70
|
-
email: andrew@chartkick.com
|
11
|
+
date: 2023-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: andrew@ankane.org
|
71
15
|
executables: []
|
72
16
|
extensions: []
|
73
17
|
extra_rdoc_files: []
|
@@ -78,11 +22,11 @@ files:
|
|
78
22
|
- lib/trend.rb
|
79
23
|
- lib/trend/client.rb
|
80
24
|
- lib/trend/version.rb
|
81
|
-
homepage: https://github.com/ankane/trend
|
25
|
+
homepage: https://github.com/ankane/trend-ruby
|
82
26
|
licenses:
|
83
27
|
- MIT
|
84
28
|
metadata: {}
|
85
|
-
post_install_message:
|
29
|
+
post_install_message:
|
86
30
|
rdoc_options: []
|
87
31
|
require_paths:
|
88
32
|
- lib
|
@@ -90,15 +34,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
34
|
requirements:
|
91
35
|
- - ">="
|
92
36
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
37
|
+
version: '3'
|
94
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
39
|
requirements:
|
96
40
|
- - ">="
|
97
41
|
- !ruby/object:Gem::Version
|
98
42
|
version: '0'
|
99
43
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
101
|
-
signing_key:
|
44
|
+
rubygems_version: 3.4.10
|
45
|
+
signing_key:
|
102
46
|
specification_version: 4
|
103
47
|
summary: Ruby client for Trend, the time series API
|
104
48
|
test_files: []
|