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

Return corresponding types for API methods #285

Merged

Conversation

AlexWayfer
Copy link
Contributor

@AlexWayfer AlexWayfer commented Jul 15, 2023

Don't touch Api#call, leave it with raw responses, but convert result in method_missing.

Resolve #284

Resolve #286 now too.

And #278 too.

Don't touch `Api#call`, leave it with raw responses,
but convert `result` in `method_missing`.
Copy link
Contributor Author

@AlexWayfer AlexWayfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few notes from the work process.

.rubocop.yml Show resolved Hide resolved
lib/telegram/bot/api.rb Show resolved Hide resolved
lib/telegram/bot/api/endpoints.rb Show resolved Hide resolved
lib/telegram/bot/api/endpoints.rb Show resolved Hide resolved
lib/telegram/bot/api/endpoints.rb Show resolved Hide resolved
lib/telegram/bot/api/endpoints.rb Show resolved Hide resolved
@AlexWayfer
Copy link
Contributor Author

I've figured out that CI secret token is empty, that's why tests are failing: #287 (comment)

Copy link
Owner

@atipugin atipugin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good, thanks! Only a few moments to address.

result = nil
client.fetch_updates { |something| result = something }

expect(result).to be_a Telegram::Bot::Types::Message
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already have a new branch, depending on this one because of these (fixed? remade?) specs, about proper bot.stop. 😅

Now `one | another` works with `.new` without required `type`.
It's not working now, but I don't why.
I've wrote to `@BotSupport`, let's wait for responses
(although it was not helpful previously).
Previously there were `Update`s with `ChatMemberUpdated`, but empty `ChatMember`s inside.
Now we'll pick correct classes and fill it with data.
There was an issue with old `ChatMember`,
I've executed Rake task and got a lot of new types and fileds,
so I've just updated them.
@AlexWayfer AlexWayfer force-pushed the return_corresponding_types_for_api_methods branch from 459d824 to e5ea5e7 Compare July 20, 2023 11:31
I had them locally and that's why there were not spec fails.

I wanted to add them with new API methods, but the scratched data has them.
@AlexWayfer
Copy link
Contributor Author

I'm waiting your decision about ENDPOINTS constant, also you might be interested in new Types::CHAT_MEMBER decision, and I suggest to merge #287 (with successful CI) before this one: then I will record requests and we'll get green CI here too.

@AlexWayfer AlexWayfer requested a review from atipugin July 31, 2023 16:48
@AlexWayfer AlexWayfer force-pushed the return_corresponding_types_for_api_methods branch from 5de21db to 79685d3 Compare August 21, 2023 09:10
@AlexWayfer
Copy link
Contributor Author

Added VCR changes from master, added cassettes for changed specs — now CI is green. 👏

There is a RuboCop offense, but for cosistency of type names let's do it so.
@atipugin atipugin self-requested a review August 21, 2023 09:26
@atipugin atipugin merged commit 8d1f15e into atipugin:master Aug 21, 2023
@AlexWayfer AlexWayfer deleted the return_corresponding_types_for_api_methods branch August 21, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update thumb fields to thumbnail Return defined types (Ruby objects)
2 participants