Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

- name: Run RSpec
run: bundle exec rspec
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.0
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source 'http://rubygems.org'

gem 'rake', '>= 10.1'
gem 'ostruct'
gem 'logger'
gem 'base64'

group :test do
gem 'rspec', '>= 3'
Expand Down
17 changes: 12 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ PATH
soundcloud (0.3.4.1)
hashie
httparty (>= 0.16.4)
logger

GEM
remote: http://rubygems.org/
specs:
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
base64 (0.3.0)
bigdecimal (4.0.1)
crack (0.4.5)
rexml
Expand All @@ -22,10 +24,12 @@ GEM
csv
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
logger (1.7.0)
mini_mime (1.1.5)
multi_xml (0.8.0)
bigdecimal (>= 3.1, < 5)
public_suffix (5.0.1)
ostruct (0.6.3)
public_suffix (7.0.5)
rake (13.0.6)
rexml (3.4.2)
rspec (3.12.0)
Expand Down Expand Up @@ -56,12 +60,15 @@ PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.1)
base64
bundler (>= 2.1)
logger
ostruct
rake (>= 10.1)
rspec (>= 3)
simplecov (>= 0.7)
soundcloud!
webmock (>= 1.13)

BUNDLED WITH
2.1.4
4.0.3
2 changes: 1 addition & 1 deletion lib/soundcloud/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def authorize_url(options={})
"#{param_name}=#{CGI.escape value}" unless value.nil?
end.compact.join("&")
store_options(options)
"https://#{host}#{AUTHORIZE_PATH}?response_type=code_and_token&client_id=#{client_id}&redirect_uri=#{URI.escape(redirect_uri)}&#{additional_params}"
"https://#{host}#{AUTHORIZE_PATH}?response_type=code_and_token&client_id=#{client_id}&redirect_uri=#{CGI.escape(redirect_uri)}&#{additional_params}"
end

def exchange_token(options={})
Expand Down
3 changes: 2 additions & 1 deletion soundcloud.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Gem::Specification.new do |spec|

spec.add_dependency('httparty', '>= 0.16.4')
spec.add_dependency('hashie')
spec.add_dependency('logger')

spec.add_development_dependency('bundler', '~> 2.1')
spec.add_development_dependency('bundler', '>= 2.1')

spec.files = Dir.glob("lib/**/*") + %w(LICENSE.md README.md)
spec.require_path = 'lib'
Expand Down
10 changes: 5 additions & 5 deletions spec/soundcloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,23 @@

describe "#authorize_url" do
it "generates a authorize_url" do
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http://come.back.to/me&")
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http%3A%2F%2Fcome.back.to%2Fme&")
end

it "generates a authorize_url and include the passed display parameter" do
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :display => "popup")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http://come.back.to/me&display=popup")
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :display => "popup")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http%3A%2F%2Fcome.back.to%2Fme&display=popup")
end

it "generates a authorize_url and include the passed state parameter" do
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :state => "hell&yeah")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http://come.back.to/me&state=hell%26yeah")
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :state => "hell&yeah")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http%3A%2F%2Fcome.back.to%2Fme&state=hell%26yeah")
end

it "generates a authorize_url and include the passed scope parameter" do
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :scope => "non-expiring")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http://come.back.to/me&scope=non-expiring")
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :scope => "non-expiring")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http%3A%2F%2Fcome.back.to%2Fme&scope=non-expiring")
end

it "generates a authorize_url and include the passed scope and state parameter" do
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :scope => "non-expiring", :state => "blub")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http://come.back.to/me&state=blub&scope=non-expiring")
expect(subject.authorize_url(:redirect_uri => "http://come.back.to/me", :scope => "non-expiring", :state => "blub")).to eq("https://soundcloud.com/connect?response_type=code_and_token&client_id=client&redirect_uri=http%3A%2F%2Fcome.back.to%2Fme&state=blub&scope=non-expiring")
end
end

Expand Down
Loading