7d 0.0.1.pre
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 +7 -0
- data/bin/7d +17 -0
- data/lib/7d/cli/app.rb +11 -0
- data/lib/7d/cli/subcommands/sign.rb +52 -0
- data/lib/7d/endpoints/clip.rb +19 -0
- data/lib/7d/endpoints/helpers/require_consumer_key.rb +15 -0
- data/lib/7d/endpoints/helpers/require_signing.rb +28 -0
- data/lib/7d/endpoints/helpers/require_signing_with_user.rb +29 -0
- data/lib/7d/endpoints/release_details.rb +14 -0
- data/lib/7d/endpoints/stream_catalogue.rb +15 -0
- data/lib/7d/endpoints/stream_subscription.rb +17 -0
- data/lib/7d/endpoints/track_details.rb +14 -0
- data/spec/integration/bin/7d_spec.rb +77 -0
- data/spec/spec_helper.rb +89 -0
- data/spec/unit/endpoints/clip_spec.rb +19 -0
- data/spec/unit/endpoints/release_details_spec.rb +17 -0
- data/spec/unit/endpoints/stream_catalogue_spec.rb +19 -0
- data/spec/unit/endpoints/stream_subscription_spec.rb +20 -0
- data/spec/unit/endpoints/track_details_spec.rb +16 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7acc4174055c750460e82d12d1e552a3cf3d779c
|
4
|
+
data.tar.gz: a69bd246b2eedd669d1f40da71eb418b119a493d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92b9918e41227b01d02792803e14561239fcaadf60a6f74fe73b72620aa172250d33d47ad684c6e3e449a942565fdee32adafded70ab3f8e4b20151568f3ae4e
|
7
|
+
data.tar.gz: e95fa4aa3ed7bab6a1c5909a61016ac806c1167d5902d86f2208b0778b1c8af8bc242fd7b1bf2cf2714451eba0884f1008f4597450b53620c74f84194d3a5d95
|
data/bin/7d
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
|
4
|
+
|
5
|
+
missing_environment_variables = false
|
6
|
+
|
7
|
+
%w(SEVENDIGITAL_CONSUMER_KEY SEVENDIGITAL_CONSUMER_SECRET).each do |variable|
|
8
|
+
if ENV[variable].nil?
|
9
|
+
STDERR.puts "#{variable} is not defined"
|
10
|
+
missing_environment_variables = true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
exit if missing_environment_variables
|
15
|
+
|
16
|
+
require '7d/cli/app'
|
17
|
+
SevenDigital::CLI::App.start(ARGV)
|
data/lib/7d/cli/app.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require '7d/endpoints/track_details'
|
3
|
+
require '7d/endpoints/release_details'
|
4
|
+
require '7d/endpoints/clip'
|
5
|
+
require '7d/endpoints/stream_catalogue'
|
6
|
+
require '7d/endpoints/stream_subscription'
|
7
|
+
|
8
|
+
module SevenDigital
|
9
|
+
module CLI
|
10
|
+
class Sign < Thor
|
11
|
+
desc 'track_details', 'track/details'
|
12
|
+
def track_details(track_id)
|
13
|
+
puts ::SevenDigital::Endpoints::TrackDetails.new(
|
14
|
+
ENV['SEVENDIGITAL_CONSUMER_KEY']
|
15
|
+
).generate_url(track_id: track_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'release_details', 'release/details'
|
19
|
+
def release_details(release_id)
|
20
|
+
puts ::SevenDigital::Endpoints::ReleaseDetails.new(
|
21
|
+
ENV['SEVENDIGITAL_CONSUMER_KEY']
|
22
|
+
).generate_url(release_id: release_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'clip', 'clip'
|
26
|
+
def clip(track_id)
|
27
|
+
puts ::SevenDigital::Endpoints::Clip.new(
|
28
|
+
ENV['SEVENDIGITAL_CONSUMER_KEY'],
|
29
|
+
ENV['SEVENDIGITAL_CONSUMER_SECRET']
|
30
|
+
).generate_url(track_id: track_id, country: 'GB')
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'stream_catalogue', 'stream/catalogue'
|
34
|
+
def stream_catalogue(track_id)
|
35
|
+
puts ::SevenDigital::Endpoints::StreamCatalogue.new(
|
36
|
+
ENV['SEVENDIGITAL_CONSUMER_KEY'],
|
37
|
+
ENV['SEVENDIGITAL_CONSUMER_SECRET']
|
38
|
+
).generate_url(track_id: track_id)
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'stream_subscription', 'stream/subscription'
|
42
|
+
def stream_subscription(track_id)
|
43
|
+
puts ::SevenDigital::Endpoints::StreamSubscription.new(
|
44
|
+
ENV['SEVENDIGITAL_CONSUMER_KEY'],
|
45
|
+
ENV['SEVENDIGITAL_CONSUMER_SECRET'],
|
46
|
+
ENV['SEVENDIGITAL_TOKEN'],
|
47
|
+
ENV['SEVENDIGITAL_TOKEN_SECRET']
|
48
|
+
).generate_url(track_id: track_id)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require '7d/endpoints/helpers/require_signing'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
class Clip
|
6
|
+
include Helpers::RequireSigning
|
7
|
+
|
8
|
+
def initialize(consumer_key, consumer_secret)
|
9
|
+
@consumer_key = consumer_key
|
10
|
+
@consumer_secret = consumer_secret
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_url(parameters)
|
14
|
+
@url = "https://previews.7digital.com/clip/#{parameters[:track_id]}"
|
15
|
+
super(parameters)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SevenDigital
|
2
|
+
module Endpoints
|
3
|
+
module Helpers
|
4
|
+
module RequireConsumerKey
|
5
|
+
def generate_url(parameters)
|
6
|
+
qs = parameters.reduce('') do |memo, (key, val)|
|
7
|
+
memo + "&#{key.to_s.sub('_', '')}=#{val}"
|
8
|
+
end
|
9
|
+
|
10
|
+
"#{@url}?oauth_consumer_key=#{@consumer_key}#{qs}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'oauth'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
module Helpers
|
6
|
+
module RequireSigning
|
7
|
+
def generate_url(parameters)
|
8
|
+
user_params = parameters.map do |key, val|
|
9
|
+
[key.to_s.sub('_', ''), val]
|
10
|
+
end.to_h
|
11
|
+
|
12
|
+
all_params = {
|
13
|
+
'oauth_consumer_key' => @consumer_key,
|
14
|
+
'oauth_timestamp' => OAuth::Helper.generate_timestamp,
|
15
|
+
'oauth_nonce' => OAuth::Helper.generate_key,
|
16
|
+
'oauth_signature_method' => 'HMAC-SHA1',
|
17
|
+
'oauth_version' => '1.0'
|
18
|
+
}.merge(user_params)
|
19
|
+
|
20
|
+
request = OAuth::RequestProxy.proxy('method' => :GET, 'uri' => @url, 'parameters' => all_params)
|
21
|
+
|
22
|
+
request.sign! consumer_secret: @consumer_secret
|
23
|
+
request.signed_uri
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'oauth'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
module Helpers
|
6
|
+
module RequireSigningWithUser
|
7
|
+
def generate_url(parameters)
|
8
|
+
user_params = parameters.map do |key, val|
|
9
|
+
[key.to_s.sub('_', ''), val]
|
10
|
+
end.to_h
|
11
|
+
|
12
|
+
all_params = {
|
13
|
+
'oauth_consumer_key' => @consumer_key,
|
14
|
+
'oauth_token' => @token_key,
|
15
|
+
'oauth_timestamp' => OAuth::Helper.generate_timestamp,
|
16
|
+
'oauth_nonce' => OAuth::Helper.generate_key,
|
17
|
+
'oauth_signature_method' => 'HMAC-SHA1',
|
18
|
+
'oauth_version' => '1.0'
|
19
|
+
}.merge(user_params)
|
20
|
+
|
21
|
+
request = OAuth::RequestProxy.proxy('method' => :GET, 'uri' => @url, 'parameters' => all_params)
|
22
|
+
|
23
|
+
request.sign! consumer_secret: @consumer_secret, token_secret: @token_secret
|
24
|
+
request.signed_uri
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require '7d/endpoints/helpers/require_consumer_key'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
class ReleaseDetails
|
6
|
+
include Helpers::RequireConsumerKey
|
7
|
+
|
8
|
+
def initialize(consumer_key)
|
9
|
+
@consumer_key = consumer_key
|
10
|
+
@url = 'https://api.7digital.com/1.2/release/details'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require '7d/endpoints/helpers/require_signing'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
class StreamCatalogue
|
6
|
+
include Helpers::RequireSigning
|
7
|
+
|
8
|
+
def initialize(consumer_key, consumer_secret)
|
9
|
+
@consumer_key = consumer_key
|
10
|
+
@consumer_secret = consumer_secret
|
11
|
+
@url = 'https://stream.svc.7digital.net/stream/catalogue'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require '7d/endpoints/helpers/require_signing_with_user'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
class StreamSubscription
|
6
|
+
include Helpers::RequireSigningWithUser
|
7
|
+
|
8
|
+
def initialize(consumer_key, consumer_secret, token_key, token_secret)
|
9
|
+
@consumer_key = consumer_key
|
10
|
+
@consumer_secret = consumer_secret
|
11
|
+
@token_key = token_key
|
12
|
+
@token_secret = token_secret
|
13
|
+
@url = 'https://stream.svc.7digital.net/stream/subscription'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require '7d/endpoints/helpers/require_consumer_key'
|
2
|
+
|
3
|
+
module SevenDigital
|
4
|
+
module Endpoints
|
5
|
+
class TrackDetails
|
6
|
+
include Helpers::RequireConsumerKey
|
7
|
+
|
8
|
+
def initialize(consumer_key)
|
9
|
+
@consumer_key = consumer_key
|
10
|
+
@url = 'https://api.7digital.com/1.2/track/details'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'open3'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
def valid_environment?
|
6
|
+
!ENV['SEVENDIGITAL_CONSUMER_KEY'].nil? && !ENV['SEVENDIGITAL_CONSUMER_SECRET'].nil?
|
7
|
+
end
|
8
|
+
|
9
|
+
module SevenDigital
|
10
|
+
RSpec.describe 'bin/7d' do
|
11
|
+
context 'with an incorrectly configured environment' do
|
12
|
+
it 'should fail with error message' do
|
13
|
+
skip 'TODO'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'with correctly configured environment', skip: !valid_environment? do
|
18
|
+
it 'should invoke thor' do
|
19
|
+
_, stdout, _ = Open3.popen3('bin/7d')
|
20
|
+
|
21
|
+
expect(stdout.gets).to match(/Commands/)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should be able to fetch track/details' do
|
25
|
+
_, stdout, _ = Open3.popen3('bin/7d sign track_details 1234')
|
26
|
+
|
27
|
+
uri = stdout.gets
|
28
|
+
|
29
|
+
open(uri) do |r|
|
30
|
+
expect(r.status[0]).to eq('200')
|
31
|
+
expect(r.read).to match(/Everyday Struggle/)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should be able to fetch release/details' do
|
36
|
+
_, stdout, _ = Open3.popen3('bin/7d sign release_details 12345')
|
37
|
+
|
38
|
+
uri = stdout.gets
|
39
|
+
|
40
|
+
open(uri) do |r|
|
41
|
+
expect(r.status[0]).to eq('200')
|
42
|
+
expect(r.read).to match(/Extremoduro/)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should be able to fetch a preview clip' do
|
47
|
+
_, stdout, _ = Open3.popen3('bin/7d sign clip 1234')
|
48
|
+
|
49
|
+
uri = stdout.gets
|
50
|
+
|
51
|
+
open(uri) do |r|
|
52
|
+
expect(r.status[0]).to eq('200')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should be able to fetch stream/catalogue' do
|
57
|
+
_, stdout, _ = Open3.popen3('bin/7d sign stream_catalogue 1234')
|
58
|
+
|
59
|
+
uri = stdout.gets
|
60
|
+
|
61
|
+
open(uri) do |r|
|
62
|
+
expect(r.status[0]).to eq('200')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should be able to fetch stream/subscription' do
|
67
|
+
_, stdout, _ = Open3.popen3('bin/7d sign stream_subscription 1234')
|
68
|
+
|
69
|
+
uri = stdout.gets
|
70
|
+
|
71
|
+
open(uri) do |r|
|
72
|
+
expect(r.status[0]).to eq('200')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
52
|
+
# recommended. For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require '7d/endpoints/clip'
|
3
|
+
|
4
|
+
module SevenDigital
|
5
|
+
module Endpoints
|
6
|
+
RSpec.describe 'Clip' do
|
7
|
+
describe '#generate_url' do
|
8
|
+
it 'should return a signed url' do
|
9
|
+
subject = Clip.new('foo', 'bar')
|
10
|
+
actual = subject.generate_url(track_id: 1234, country: 'GB')
|
11
|
+
|
12
|
+
expect(actual).to start_with('https://previews.7digital.com/clip/1234')
|
13
|
+
expect(actual).to include('oauth_signature=')
|
14
|
+
expect(actual).to include('country=GB')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require '7d/endpoints/release_details'
|
3
|
+
|
4
|
+
module SevenDigital
|
5
|
+
module Endpoints
|
6
|
+
RSpec.describe 'ReleaseDetails' do
|
7
|
+
describe '#generate_url' do
|
8
|
+
it 'should return a signed url' do
|
9
|
+
subject = ReleaseDetails.new('foo')
|
10
|
+
actual = subject.generate_url(release_id: 1234)
|
11
|
+
|
12
|
+
expect(actual).to eq('https://api.7digital.com/1.2/release/details?oauth_consumer_key=foo&releaseid=1234')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require '7d/endpoints/stream_catalogue'
|
3
|
+
|
4
|
+
module SevenDigital
|
5
|
+
module Endpoints
|
6
|
+
RSpec.describe 'StreamCatalogue' do
|
7
|
+
describe '#generate_url' do
|
8
|
+
it 'should return a signed url' do
|
9
|
+
subject = StreamCatalogue.new('foo', 'bar')
|
10
|
+
actual = subject.generate_url(track_id: 1234)
|
11
|
+
|
12
|
+
expect(actual).to start_with('https://stream.svc.7digital.net/stream/catalogue')
|
13
|
+
expect(actual).to include('trackid=1234')
|
14
|
+
expect(actual).to include('&oauth_signature=')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require '7d/endpoints/stream_subscription'
|
3
|
+
|
4
|
+
module SevenDigital
|
5
|
+
module Endpoints
|
6
|
+
RSpec.describe 'StreamSubscription' do
|
7
|
+
describe '#generate_url' do
|
8
|
+
it 'should return a signed url' do
|
9
|
+
subject = StreamSubscription.new('foo', 'bar', 'baz', 'qux')
|
10
|
+
actual = subject.generate_url(track_id: 1234)
|
11
|
+
|
12
|
+
expect(actual).to start_with('https://stream.svc.7digital.net/stream/subscription')
|
13
|
+
expect(actual).to include('trackid=1234')
|
14
|
+
expect(actual).to include('oauth_token=baz')
|
15
|
+
expect(actual).to include('&oauth_signature=')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require '7d/endpoints/track_details'
|
3
|
+
|
4
|
+
module SevenDigital
|
5
|
+
module Endpoints
|
6
|
+
RSpec.describe 'TrackDetails' do
|
7
|
+
describe '#generate_url' do
|
8
|
+
it 'should return a signed url' do
|
9
|
+
subject = TrackDetails.new('foo')
|
10
|
+
|
11
|
+
expect(subject.generate_url(track_id: 1234)).to eq('https://api.7digital.com/1.2/track/details?oauth_consumer_key=foo&trackid=1234')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: 7d
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sam Crang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.19.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.19.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.2.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.2'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.2.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rubocop
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.29.1
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.29.1
|
75
|
+
description: |2
|
76
|
+
Generates signed URLs for the 7digital API. Useful for piping between
|
77
|
+
various other command line tools.
|
78
|
+
email: sam.crang+rubygems@gmail.com
|
79
|
+
executables:
|
80
|
+
- 7d
|
81
|
+
extensions: []
|
82
|
+
extra_rdoc_files: []
|
83
|
+
files:
|
84
|
+
- bin/7d
|
85
|
+
- lib/7d/cli/app.rb
|
86
|
+
- lib/7d/cli/subcommands/sign.rb
|
87
|
+
- lib/7d/endpoints/clip.rb
|
88
|
+
- lib/7d/endpoints/helpers/require_consumer_key.rb
|
89
|
+
- lib/7d/endpoints/helpers/require_signing.rb
|
90
|
+
- lib/7d/endpoints/helpers/require_signing_with_user.rb
|
91
|
+
- lib/7d/endpoints/release_details.rb
|
92
|
+
- lib/7d/endpoints/stream_catalogue.rb
|
93
|
+
- lib/7d/endpoints/stream_subscription.rb
|
94
|
+
- lib/7d/endpoints/track_details.rb
|
95
|
+
- spec/integration/bin/7d_spec.rb
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
- spec/unit/endpoints/clip_spec.rb
|
98
|
+
- spec/unit/endpoints/release_details_spec.rb
|
99
|
+
- spec/unit/endpoints/stream_catalogue_spec.rb
|
100
|
+
- spec/unit/endpoints/stream_subscription_spec.rb
|
101
|
+
- spec/unit/endpoints/track_details_spec.rb
|
102
|
+
homepage: https://github.com/samcrang/7digital-cli
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 1.3.1
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.5
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Provides a CLI to the 7digital API
|
126
|
+
test_files: []
|