Class: GrubY::Story
- Inherits:
-
BaseObject
show all
- Defined in:
- lib/gruubY/types/extra.rb,
lib/gruubY/types/bound_entities.rb
Constant Summary
collapse
- STORY_SENDERS =
{
animation: "sendAnimation",
audio: "sendAudio",
cached_media: "sendDocument",
media_group: "sendMediaGroup",
photo: "sendPhoto",
sticker: "sendSticker",
video: "sendVideo",
video_note: "sendVideoNote",
voice: "sendVoice"
}.freeze
Instance Attribute Summary
Attributes inherited from BaseObject
#api, #client
Instance Method Summary
collapse
Methods inherited from BaseObject
#[], #dig, field_names, fields, #method_missing, #respond_to_missing?, #to_h
Constructor Details
#initialize(data) ⇒ Story
Returns a new instance of Story.
131
132
133
134
|
# File 'lib/gruubY/types/extra.rb', line 131
def initialize(data)
super(data)
@chat = Chat.new(@chat) if @chat.is_a?(Hash)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class GrubY::BaseObject
Instance Method Details
#delete ⇒ Object
132
133
134
|
# File 'lib/gruubY/types/bound_entities.rb', line 132
def delete
call_raw_api("deleteStories", { story_ids: [id] })
end
|
#download(file_name = "story.dat") ⇒ Object
156
157
158
|
# File 'lib/gruubY/types/bound_entities.rb', line 156
def download(file_name = "story.dat")
call_raw_api("downloadFile", { story_id: id, file_name: file_name })
end
|
#edit_caption(caption, **opts) ⇒ Object
140
141
142
|
# File 'lib/gruubY/types/bound_entities.rb', line 140
def edit_caption(caption, **opts)
call_raw_api("editStoryCaption", { story_id: id, caption: caption.to_s }.merge(opts))
end
|
136
137
138
|
# File 'lib/gruubY/types/bound_entities.rb', line 136
def edit_media(media, **opts)
call_raw_api("editStoryMedia", { story_id: id, media: media }.merge(opts))
end
|
#edit_privacy(privacy, **opts) ⇒ Object
144
145
146
|
# File 'lib/gruubY/types/bound_entities.rb', line 144
def edit_privacy(privacy, **opts)
call_raw_api("editStoryPrivacy", { story_id: id, privacy: privacy }.merge(opts))
end
|
#forward(chat_id:) ⇒ Object
152
153
154
|
# File 'lib/gruubY/types/bound_entities.rb', line 152
def forward(chat_id:)
call_raw_api("forwardStory", { story_id: id, chat_id: chat_id })
end
|
#react(reaction) ⇒ Object
148
149
150
|
# File 'lib/gruubY/types/bound_entities.rb', line 148
def react(reaction)
call_raw_api("setStoryReaction", { story_id: id, reaction: reaction })
end
|
#read ⇒ Object
160
161
162
|
# File 'lib/gruubY/types/bound_entities.rb', line 160
def read
call_raw_api("readChatStories", { story_id: id })
end
|
#reply_text(text, **opts) ⇒ Object
Also known as:
reply, answer
93
94
95
96
|
# File 'lib/gruubY/types/bound_entities.rb', line 93
def reply_text(text, **opts)
chat_id = chat.is_a?(Hash) ? chat["id"] : chat&.id
call_api("sendMessage", { chat_id: chat_id, text: text.to_s }.merge(opts))
end
|
#view ⇒ Object
164
165
166
|
# File 'lib/gruubY/types/bound_entities.rb', line 164
def view
call_raw_api("viewStories", { story_ids: [id] })
end
|