-
Notifications
You must be signed in to change notification settings - Fork 128
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
create validate_rich_menu method #259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your sending this pull request! I made a few comments, so please check them in your spare time.
lib/line/bot/client.rb
Outdated
@@ -547,6 +547,18 @@ def create_rich_menu(rich_menu) | |||
post(endpoint, endpoint_path, rich_menu.to_json, credentials) | |||
end | |||
|
|||
# Validate a rich menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nice to have]
This endpoint validates an object of the rich menu.
# Validate a rich menu | |
# Validate a rich menu object |
lib/line/bot/client.rb
Outdated
# @param rich_menu [Hash] The rich menu represented as a rich menu object | ||
# | ||
# @return [Net::HTTPResponse] | ||
def validate_rich_menu(rich_menu) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[must fix]
Unlike other endpoints, this endpoint validates an object, not a rich menu. So the name should be represented more accurately.
def validate_rich_menu(rich_menu) | |
def validate_rich_menu_object(rich_menu) |
spec/line/bot/rich_menu_spec.rb
Outdated
it 'validates a rich menu' do | ||
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/validate' | ||
stub_request(:post, uri_template).to_return(body: '{}', status: 200) | ||
|
||
client.validate_rich_menu(JSON.parse(RICH_MENU_CONTENT)) | ||
expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/validate') | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[must fix]
This should be changed according to the change of the method name.
it 'validates a rich menu' do | |
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/validate' | |
stub_request(:post, uri_template).to_return(body: '{}', status: 200) | |
client.validate_rich_menu(JSON.parse(RICH_MENU_CONTENT)) | |
expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/validate') | |
end | |
it 'validates a rich menu object' do | |
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/validate' | |
stub_request(:post, uri_template).to_return(body: '{}', status: 200) | |
client.validate_rich_menu_object(JSON.parse(RICH_MENU_CONTENT)) | |
expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/validate') | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review.
I understand your comments and I will fix it later.
All comments have been addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@kenta-takeuchi san |
@zenizh |
i'd like to write a new validate rich menu api.