-
Notifications
You must be signed in to change notification settings - Fork 2
Add token_info method, bump version #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d491dea
Add token_info method, bump version
dmitrytrager d54c47e
Use app_id from config
dmitrytrager ba1c60d
Do not check response status
dmitrytrager d31dde5
Extract token response parsing into separate class
dmitrytrager 3ca8cd2
Try to change Ruby version matrix
dmitrytrager 53f8b9e
Use TokenInfo class to wrap results
dmitrytrager 333e0e7
Keep client imports sorted
dmitrytrager File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.5.0 | ||
|
||
* Add `token_info` [method](https://business-api.tiktok.com/portal/docs?id=1765927978092545) to validate TikTok profiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Panda | ||
class TokenInfo | ||
attr_reader :data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we don't use this reader anywhere |
||
|
||
def initialize(response) | ||
@data = response.parsed_body.fetch('data', {}) | ||
end | ||
|
||
def [](key) | ||
data[key] | ||
end | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Panda | ||
VERSION = '0.4.0' | ||
VERSION = '0.5.0' | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe Panda::TokenInfo do | ||
let(:response) { Panda::HTTPResponse.new(200, {}, token_response_body) } | ||
|
||
context 'response with result list field in data field' do | ||
let(:token_response_body) do | ||
{ | ||
'message' => 'OK', | ||
'code' => 0, | ||
'data' => { | ||
'app_id' => Panda.config.app_id, | ||
'creator_id' => 'test_creator_id', | ||
'scope' => 'user.info.basic' | ||
}, | ||
'request_id': '2020031009181201018904922342087A16' | ||
} | ||
end | ||
|
||
it 'gets token info' do | ||
token_info = described_class.new(response) | ||
|
||
expect(token_info['creator_id']).to eq('test_creator_id') | ||
expect(token_info['scope']).to eq('user.info.basic') | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.