Module: Twitty::Payload
- Included in:
- Facade
- Defined in:
- lib/twitty/payload.rb
Constant Summary collapse
- EMPTY_PAYLOAD_ACTIONS =
%w[fetch_webhooks register_webhook unregister_webhook fetch_subscriptions create_subscription remove_subscription destroy_tweet retweet unretweet user_show ].freeze
Instance Method Summary collapse
- #access_token_payload ⇒ Object
- #build_payload(action, payload) ⇒ Object
- #like_tweet_payload ⇒ Object
- #request_oauth_token_payload ⇒ Object
- #send_direct_message_payload ⇒ Object
- #send_tweet_reply_payload ⇒ Object
- #unlike_tweet_payload ⇒ Object
Instance Method Details
#access_token_payload ⇒ Object
47 48 49 50 51 52 |
# File 'lib/twitty/payload.rb', line 47 def access_token_payload { oauth_token: @payload[:oauth_token], oauth_verifier: @payload[:oauth_verifier] } end |
#build_payload(action, payload) ⇒ Object
13 14 15 16 |
# File 'lib/twitty/payload.rb', line 13 def build_payload(action, payload) @payload = payload send("#{action}_payload") end |
#like_tweet_payload ⇒ Object
54 55 56 57 58 |
# File 'lib/twitty/payload.rb', line 54 def like_tweet_payload { id: @payload[:tweet_id] } end |
#request_oauth_token_payload ⇒ Object
41 42 43 44 45 |
# File 'lib/twitty/payload.rb', line 41 def request_oauth_token_payload { oauth_callback: @payload[:url] } end |
#send_direct_message_payload ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/twitty/payload.rb', line 18 def { event: { type: 'message_create', message_create: { target: { recipient_id: @payload[:recipient_id] }, message_data: { text: @payload[:message] } } } }.to_json end |
#send_tweet_reply_payload ⇒ Object
34 35 36 37 38 39 |
# File 'lib/twitty/payload.rb', line 34 def send_tweet_reply_payload { status: @payload[:tweet], in_reply_to_status_id: @payload[:reply_to_tweet_id] } end |
#unlike_tweet_payload ⇒ Object
60 61 62 63 64 |
# File 'lib/twitty/payload.rb', line 60 def unlike_tweet_payload { id: @payload[:tweet_id] } end |