dubbletrack_remote 0.8.5 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f010dd701e69b829033ec0e81a719bd434e94fcc6e362fa0ddbd8033f3ccd807
4
- data.tar.gz: 4032b921ae342c7503bf84dab7cbcb7e8a1cd5b0f2961499b884371dd31e551b
3
+ metadata.gz: c5403b60e14bbb678bd91fc7239bd42fd758c8a3567bcf28dfc2c68feeacb631
4
+ data.tar.gz: 7e8e942433eb87f3fb4711227bafde47bc22ab175ddb38740a5b2b783760f899
5
5
  SHA512:
6
- metadata.gz: e0849e9c7d88b10e3476118810340b36af9cc2488cd777e6b83cff85482d41fd8ded09895880c4c4c6a31ccbda06778e903748794c585fd3860ed302b3ee7db8
7
- data.tar.gz: 5f2f7e2df1169cab46346192c575044274cc1b1584f08452750260d84e6c72196e48638fea47548ef13c407be16ad5f4823a766f0b4fd691f0e5f44c869bcbd8
6
+ metadata.gz: 326d9c86009ff129128727b2af4ad9973916b91213819a924c56f017c7a8560871cd15ef9ba07f315700f1d9fd242baa5ac40d3ca3ef4bc8225769fbbbd0a06e
7
+ data.tar.gz: 021dd99e9f5e7c3ec99d3d8e2cbe4535b4e7d2890f4c2d159cb64e1c822232de13906e9b59a2cae74d26b98e1ada898ea567456986c43a3a25565995d5bc1e48
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  dubbletrack remote changelog
2
2
 
3
+ # [0.9.0](https://github.com/dubbletrack/remote/compare/v0.8.5...v0.9.0) (2026-01-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * upgrade to single shared secret authentication and away from api-key + api-token ([a021359](https://github.com/dubbletrack/remote/commit/a021359a2b50cd7f9592d13c8ff9f4018734dc57))
9
+
3
10
  ## [0.8.5](https://github.com/dubbletrack/remote/compare/v0.8.4...v0.8.5) (2024-07-10)
4
11
 
5
12
 
@@ -1,6 +1,5 @@
1
1
  api_url: https://data.dubbletrack.com/api/v2/automation
2
- api_key:
3
- api_secret:
2
+ access_token: dt_priv_******
4
3
  automation:
5
4
  type: enco
6
5
  playlist_path: /mnt/ENCO/DAD/Asplay/ENCO1%m%d%y.DBF
@@ -254,8 +254,7 @@ module DubbletrackRemote
254
254
  def client
255
255
  @client ||= Client.new(
256
256
  url: settings[:api_url],
257
- key: settings[:api_key],
258
- secret: settings[:api_secret]
257
+ token: settings[:access_token],
259
258
  )
260
259
  end
261
260
 
@@ -315,8 +314,7 @@ module DubbletrackRemote
315
314
  content = ""
316
315
  create_file(settings_path) do
317
316
  station_id = ask "What's your dubbletrack station ID? (e.g. koop, kvrx)"
318
- api_key = ask "What's your dubbletrack API Key?"
319
- api_secret = ask "What's your dubbletrack API Secret?", echo: false
317
+ access_token = ask "What's your dubbletrack Access Token? It should start with dt_priv"
320
318
  automation_type = ask "What kind of automation system is this?", default: "enco"
321
319
  dump_delay = ask "How much of a delay (in seconds) is there before broadcast? (i.e. do you have a dump button)", default: 0
322
320
  time_zone = ask "What timezone are you in?", default: "America/Chicago"
@@ -328,8 +326,7 @@ module DubbletrackRemote
328
326
  end
329
327
  <<~YAMS.strip
330
328
  api_url: https://api.dubbletrack.com/api/v2/automation
331
- api_key: #{api_key}
332
- api_secret: #{api_secret}
329
+ access_token: #{access_token}
333
330
  automation:
334
331
  time_zone: #{time_zone}
335
332
  type: #{automation_type}
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DubbletrackRemote
4
4
  class Client
5
- def initialize(url:, key:, secret:)
5
+ def initialize(url:, token:)
6
6
  @client = Faraday.new(url: url) do |faraday|
7
7
  faraday.request :retry,
8
8
  max: 2,
@@ -14,8 +14,7 @@ module DubbletrackRemote
14
14
  end
15
15
 
16
16
  @url = url # || 'https://api.dubbletrack.com/api/v2/automation'
17
- @key = key # || 'dt_xxxxxxxx'
18
- @secret = secret # || 'dts_xxxxxxxxxxxx'
17
+ @token = token # || 'dt_priv_xxxxxxxx'
19
18
  end
20
19
 
21
20
  def send(items)
@@ -27,8 +26,7 @@ module DubbletrackRemote
27
26
 
28
27
  headers = {
29
28
  :"Content-Type" => "application/json",
30
- :"X-API-KEY" => @key,
31
- :"X-API-SECRET" => @secret,
29
+ :"X-ACCESS-TOKEN" => @token,
32
30
  "User-Agent" => "Dubbletrack Remote"
33
31
  }
34
32
 
@@ -49,12 +47,12 @@ module DubbletrackRemote
49
47
 
50
48
  found_response = if data.size > 1
51
49
  data.find do |d|
52
- d["remote_automation_id"] == item.automation_id
50
+ d["data"]["remote_automation_id"] == item.automation_id
53
51
  end
54
52
  else
55
53
  data.first
56
54
  end
57
- item.remote_id = found_response["uuid"] if found_response
55
+ item.remote_id = found_response["data"]["uuid"] if found_response
58
56
  item.save
59
57
  puts item.pretty_print
60
58
  end
@@ -63,8 +61,18 @@ module DubbletrackRemote
63
61
  end
64
62
  else
65
63
  items.each do |item|
64
+ data = JSON.parse(response.body).dig("data")
65
+
66
+ found_response = if data.size > 1
67
+ data.find do |d|
68
+ d["data"]["remote_automation_id"] == item.automation_id
69
+ end
70
+ else
71
+ data.first
72
+ end
73
+
66
74
  item.success = false
67
- error = DubbletrackRemote::Error.new(response)
75
+ error = DubbletrackRemote::Error.new(found_response || response)
68
76
  raise DubbletrackRemote::RateLimitError if error.text == "Rate Limit Exceeded"
69
77
  item.last_error_text = error.text
70
78
  item.last_error_code = error.code
@@ -85,7 +93,7 @@ module DubbletrackRemote
85
93
 
86
94
  def key_map(key)
87
95
  map = {
88
- automation_group: :remote_automation_group,
96
+ automation_group: :remote_automationautomation_sourcegroup,
89
97
  automation_id: :remote_automation_id,
90
98
  automation_system: :remote_automation_system,
91
99
  source: :remote_automation_source,
@@ -5,12 +5,20 @@ module DubbletrackRemote
5
5
  end
6
6
 
7
7
  class Error
8
- attr_accessor :time, :text, :code
8
+ attr_accessor :time, :text, :code, :status
9
9
 
10
10
  def initialize(response)
11
11
  @time = Time.now.iso8601
12
- @code = response.status
13
- @text = error_text(response)
12
+
13
+ if response.is_a?(Hash)
14
+ @status = response.dig("status")
15
+ @code = response.dig("errors", "code")
16
+ @text = response.dig("errors", "detail")
17
+ else
18
+ @status = response.status
19
+ @code = response.status
20
+ @text = error_text(response)
21
+ end
14
22
  end
15
23
 
16
24
  def error_text(response)
@@ -1,3 +1,3 @@
1
1
  module DubbletrackRemote
2
- VERSION = "0.8.5"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dubbletrack_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Keen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-10 00:00:00.000000000 Z
11
+ date: 2026-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -406,7 +406,7 @@ homepage: http://github.com/dubbletrack/remote
406
406
  licenses:
407
407
  - MIT
408
408
  metadata: {}
409
- post_install_message:
409
+ post_install_message:
410
410
  rdoc_options: []
411
411
  require_paths:
412
412
  - lib
@@ -421,8 +421,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
421
421
  - !ruby/object:Gem::Version
422
422
  version: '0'
423
423
  requirements: []
424
- rubygems_version: 3.3.5
425
- signing_key:
424
+ rubygems_version: 3.4.20
425
+ signing_key:
426
426
  specification_version: 4
427
427
  summary: Posts data from automation systems to dubbletrack.com. Requires dubbletrack
428
428
  account