Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action to fetch user's ZAK token #469

Merged
merged 1 commit into from
Jan 27, 2024
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
2 changes: 2 additions & 0 deletions lib/zoom/actions/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ module User

patch 'user_status_update', '/users/:id/status',
permit: :status

get 'user_zak', '/users/me/zak'
end
end
end
3 changes: 3 additions & 0 deletions spec/fixtures/user/zak.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"token": "eyJ0eXAiOiJKV1QiLCJzdiI6IjAwMDAwMSIsInptX3NrbSI6InptX28ybSIsImFsZyI6IkhTMjU2In0.eyJhdWQiOiJjb"
}
26 changes: 26 additions & 0 deletions spec/lib/zoom/actions/user/zak_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require 'spec_helper'

describe Zoom::Actions::User do
let(:zc) { zoom_client }

describe '#user_zak action' do
context 'with a valid response' do
before :each do
stub_request(
:get,
zoom_url("/users/me/zak")
).to_return(status: 200,
body: json_response('user', 'zak'),
headers: { 'Content-Type' => 'application/json' })
end

it 'returns a users zak token' do
res = zc.user_zak
expected_response = JSON.parse(json_response('user', 'zak'))
expect(res['token']).to eq(expected_response['token'])
end
end
end
end
Loading