atipugin / telegram-bot-ruby

Ruby wrapper for Telegram's Bot API
https://core.telegram.org/bots/api
Do What The F*ck You Want To Public License
1.35k stars 218 forks source link

Add activesupport support #248

Closed vsevolod closed 1 year ago

vsevolod commented 2 years ago

I've got this message when using the gem:

Telegram::Bot::Exceptions::ResponseError: Telegram API has returned the error. (ok: "false", error_code: "400", description: "Bad Request: can't parse inline query result: Field "url" must be of type String")

This was because activesupport calls as_json instead to_json while using to_json on an array. And the objects (Telegram::Bot::Types::InputTextMessageContent.new) didn't compact.

This PR fix it

Also I rewrote to_compact_hash method. Now it runs faster and creates less objects.

github-actions[bot] commented 1 year ago

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.