Module: Twitter::REST::DirectMessages::WelcomeMessages
- Includes:
- UploadUtils, Utils, Utils
- Included in:
- API
- Defined in:
- lib/twitter/rest/direct_messages/welcome_messages.rb
Constant Summary
Constants included from Utils
Instance Method Summary collapse
-
#create_welcome_message(text, name = nil, options = {}) ⇒ Object
Welcome Message.
-
#create_welcome_message_rule(welcome_message_id, options = {}) ⇒ Object
Welcome Message Rule.
- #destroy_welcome_message(*ids) ⇒ Object
- #destroy_welcome_message_rule(*ids) ⇒ Object
- #update_welcome_message(welcome_message_id, text, options = {}) ⇒ Object
- #welcome_message(id, options = {}) ⇒ Object
- #welcome_message_list(options = {}) ⇒ Object
- #welcome_message_rule(id, options = {}) ⇒ Object
- #welcome_message_rule_list(options = {}) ⇒ Object
Methods included from Utils
Instance Method Details
#create_welcome_message(text, name = nil, options = {}) ⇒ Object
Welcome Message
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 16 def (text, name = nil, = {}) = { welcome_message: { message_data: { text:, }, }, } [:welcome_message][:name] = name if name = perform_request_with_object(:json_post, "/1.1/direct_messages/welcome_messages/new.json", .merge!(), Twitter::DirectMessages::WelcomeMessageWrapper) . end |
#create_welcome_message_rule(welcome_message_id, options = {}) ⇒ Object
Welcome Message Rule
61 62 63 64 65 66 67 68 69 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 61 def (, = {}) = { welcome_message_rule: { welcome_message_id:, }, } rule_wrapper = perform_request_with_object(:json_post, "/1.1/direct_messages/welcome_messages/rules/new.json", .merge!(), Twitter::DirectMessages::WelcomeMessageRuleWrapper) rule_wrapper. end |
#destroy_welcome_message(*ids) ⇒ Object
29 30 31 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 29 def (*ids) perform_requests(:delete, "/1.1/direct_messages/welcome_messages/destroy.json", ids) end |
#destroy_welcome_message_rule(*ids) ⇒ Object
71 72 73 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 71 def (*ids) perform_requests(:delete, "/1.1/direct_messages/welcome_messages/rules/destroy.json", ids) end |
#update_welcome_message(welcome_message_id, text, options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 33 def (, text, = {}) params = { id: , } = { message_data: { text:, }, } = perform_request_with_object(:json_put, "/1.1/direct_messages/welcome_messages/update.json", .merge!(), Twitter::DirectMessages::WelcomeMessageWrapper, params) . end |
#welcome_message(id, options = {}) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 46 def (id, = {}) = .dup [:id] = id = perform_get_with_object("/1.1/direct_messages/welcome_messages/show.json", , Twitter::DirectMessages::WelcomeMessageWrapper) . end |
#welcome_message_list(options = {}) ⇒ Object
53 54 55 56 57 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 53 def ( = {}) limit = .fetch(:count, 20) = perform_get_with_cursor("/1.1/direct_messages/welcome_messages/list.json", .merge!(no_default_cursor: true, count: 50, limit:), :welcome_messages, Twitter::DirectMessages::WelcomeMessageWrapper) .collect(&:welcome_message) end |
#welcome_message_rule(id, options = {}) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 75 def (id, = {}) = .dup [:id] = id rule_wrapper = perform_get_with_object("/1.1/direct_messages/welcome_messages/rules/show.json", , Twitter::DirectMessages::WelcomeMessageRuleWrapper) rule_wrapper. end |
#welcome_message_rule_list(options = {}) ⇒ Object
82 83 84 85 86 |
# File 'lib/twitter/rest/direct_messages/welcome_messages.rb', line 82 def ( = {}) limit = .fetch(:count, 20) rule_wrappers = perform_get_with_cursor("/1.1/direct_messages/welcome_messages/rules/list.json", .merge!(no_default_cursor: true, count: 50, limit:), :welcome_message_rules, Twitter::DirectMessages::WelcomeMessageRuleWrapper) rule_wrappers.collect(&:welcome_message_rule) end |