-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from revealbot/chore/tiktok-access-lost-DD-4674
Add token_info method, bump version
- Loading branch information
Showing
9 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 | ||
|
||
def initialize(response) | ||
@data = response.parsed_body.fetch('data', {}) | ||
end | ||
|
||
def [](key) | ||
data[key] | ||
end | ||
end | ||
end |
This file contains 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 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 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 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 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 |