trend 0.2.0 → 0.3.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/CHANGELOG.md +9 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -6
- data/lib/trend/client.rb +5 -1
- data/lib/trend/version.rb +1 -1
- data/lib/trend.rb +1 -1
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dd4169b6d3932dcc5365b0f7bf312a3613928d8ef619b86540f6d12791bfd9b
|
4
|
+
data.tar.gz: 3decea62bc51cc575c9c7fc9c0f7b45a4ab1779fe3cfd4c1f071d4ee9fe439a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d71e65bc0aee64cceff4fe6310c6383872aa9c73eaff8091728d08114750b176061e9c43179dc1417c03a57e5e2b2b241c2e951e35616254846e8f2d923a127
|
7
|
+
data.tar.gz: fb2339f7fa80088b4f61ba827faf457d41355e3b5d341e575588aa0c87dfee71c292e10a4cc584524882411f94446e4b8a438605ddfb86671e35e4d78a9a2cb6
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Trend Ruby
|
2
2
|
|
3
|
-
Ruby client for [Trend](https://
|
3
|
+
Ruby client for [Trend](https://github.com/ankane/trend-api), the anomaly detection and forecasting API
|
4
4
|
|
5
|
-
[
|
5
|
+
**Note: The [hosted version](https://trendapi.org/) is no longer available. [See how to run the API on your own infrastructure.](https://github.com/ankane/trend-api)**
|
6
|
+
|
7
|
+
[](https://github.com/ankane/trend-ruby/actions)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -12,7 +14,7 @@ Add this line to your application’s Gemfile:
|
|
12
14
|
gem "trend"
|
13
15
|
```
|
14
16
|
|
15
|
-
|
17
|
+
And set the URL to the API:
|
16
18
|
|
17
19
|
```ruby
|
18
20
|
Trend.url = "http://localhost:8000"
|
@@ -25,7 +27,7 @@ Detect anomalies in a time series
|
|
25
27
|
```ruby
|
26
28
|
# generate series
|
27
29
|
series = {}
|
28
|
-
date = Date.parse("
|
30
|
+
date = Date.parse("2025-01-01")
|
29
31
|
28.times do
|
30
32
|
series[date] = rand(100)
|
31
33
|
date += 1
|
@@ -50,7 +52,7 @@ Get future predictions for a time series
|
|
50
52
|
|
51
53
|
```ruby
|
52
54
|
series = {}
|
53
|
-
date = Date.parse("
|
55
|
+
date = Date.parse("2025-01-01")
|
54
56
|
28.times do
|
55
57
|
series[date] = date.wday
|
56
58
|
date += 1
|
@@ -72,7 +74,7 @@ Specify the number of predictions to return
|
|
72
74
|
Trend.forecast(series, count: 3)
|
73
75
|
```
|
74
76
|
|
75
|
-
## Correlation
|
77
|
+
## Correlation (Experimental)
|
76
78
|
|
77
79
|
Get the correlation between two time series
|
78
80
|
|
data/lib/trend/client.rb
CHANGED
@@ -10,7 +10,11 @@ module Trend
|
|
10
10
|
|
11
11
|
def initialize(url: nil, api_key: nil, timeout: 30)
|
12
12
|
@api_key = api_key || Trend.api_key
|
13
|
-
|
13
|
+
url ||= Trend.url
|
14
|
+
if !url
|
15
|
+
raise ArgumentError, "Trend url not set"
|
16
|
+
end
|
17
|
+
@uri = URI.parse(url)
|
14
18
|
@http = Net::HTTP.new(@uri.host, @uri.port)
|
15
19
|
@http.use_ssl = true if @uri.scheme == "https"
|
16
20
|
@http.open_timeout = timeout
|
data/lib/trend/version.rb
CHANGED
data/lib/trend.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-04-04 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
|
-
description:
|
14
12
|
email: andrew@ankane.org
|
15
13
|
executables: []
|
16
14
|
extensions: []
|
@@ -26,7 +24,6 @@ homepage: https://github.com/ankane/trend-ruby
|
|
26
24
|
licenses:
|
27
25
|
- MIT
|
28
26
|
metadata: {}
|
29
|
-
post_install_message:
|
30
27
|
rdoc_options: []
|
31
28
|
require_paths:
|
32
29
|
- lib
|
@@ -34,15 +31,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
34
31
|
requirements:
|
35
32
|
- - ">="
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version: '3'
|
34
|
+
version: '3.2'
|
38
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
36
|
requirements:
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '0'
|
43
40
|
requirements: []
|
44
|
-
rubygems_version: 3.
|
45
|
-
signing_key:
|
41
|
+
rubygems_version: 3.6.2
|
46
42
|
specification_version: 4
|
47
43
|
summary: Ruby client for Trend, the time series API
|
48
44
|
test_files: []
|