trend 0.2.1 → 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 +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +5 -5
- data/lib/trend/client.rb +5 -1
- data/lib/trend/version.rb +1 -1
- data/lib/trend.rb +1 -7
- 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
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Ruby client for [Trend](https://github.com/ankane/trend-api), the anomaly detection and forecasting API
|
4
4
|
|
5
|
-
**Note: The [hosted version](https://trendapi.org/) is
|
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
6
|
|
7
|
-
[](https://github.com/ankane/trend-ruby/actions)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -27,7 +27,7 @@ Detect anomalies in a time series
|
|
27
27
|
```ruby
|
28
28
|
# generate series
|
29
29
|
series = {}
|
30
|
-
date = Date.parse("
|
30
|
+
date = Date.parse("2025-01-01")
|
31
31
|
28.times do
|
32
32
|
series[date] = rand(100)
|
33
33
|
date += 1
|
@@ -52,7 +52,7 @@ Get future predictions for a time series
|
|
52
52
|
|
53
53
|
```ruby
|
54
54
|
series = {}
|
55
|
-
date = Date.parse("
|
55
|
+
date = Date.parse("2025-01-01")
|
56
56
|
28.times do
|
57
57
|
series[date] = date.wday
|
58
58
|
date += 1
|
@@ -74,7 +74,7 @@ Specify the number of predictions to return
|
|
74
74
|
Trend.forecast(series, count: 3)
|
75
75
|
```
|
76
76
|
|
77
|
-
## Correlation
|
77
|
+
## Correlation (Experimental)
|
78
78
|
|
79
79
|
Get the correlation between two time series
|
80
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
@@ -24,7 +24,7 @@ module Trend
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.url
|
27
|
-
@url ||= ENV["TREND_URL"]
|
27
|
+
@url ||= ENV["TREND_URL"]
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.url=(url)
|
@@ -45,10 +45,4 @@ module Trend
|
|
45
45
|
def self.client
|
46
46
|
@client ||= Client.new
|
47
47
|
end
|
48
|
-
|
49
|
-
# private
|
50
|
-
def self.hosted_url
|
51
|
-
warn "[trend] WARNING: The hosted version is shutting down on May 1, 2024. See https://github.com/ankane/trend-api for how to run the API on your own infrastructure."
|
52
|
-
"https://trendapi.org"
|
53
|
-
end
|
54
48
|
end
|
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: []
|