Class: Boppers::Notifier::Twitter
- Inherits:
-
Object
- Object
- Boppers::Notifier::Twitter
- Defined in:
- lib/boppers/notifier/twitter.rb
Instance Attribute Summary collapse
-
#access_secret ⇒ Object
readonly
Returns the value of attribute access_secret.
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#consumer_key ⇒ Object
readonly
Returns the value of attribute consumer_key.
-
#consumer_secret ⇒ Object
readonly
Returns the value of attribute consumer_secret.
-
#subscribe ⇒ Object
readonly
Returns the value of attribute subscribe.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #call(title, message, _options) ⇒ Object
-
#initialize(consumer_key:, consumer_secret:, access_token:, access_secret:, user:, subscribe: nil) ⇒ Twitter
constructor
A new instance of Twitter.
Constructor Details
#initialize(consumer_key:, consumer_secret:, access_token:, access_secret:, user:, subscribe: nil) ⇒ Twitter
Returns a new instance of Twitter.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/boppers/notifier/twitter.rb', line 9 def initialize(consumer_key:, consumer_secret:, access_token:, access_secret:, user:, subscribe: nil) require "twitter" @consumer_key = consumer_key @consumer_secret = consumer_secret @access_token = access_token @access_secret = access_secret @user = user @subscribe = subscribe end |
Instance Attribute Details
#access_secret ⇒ Object (readonly)
Returns the value of attribute access_secret.
6 7 8 |
# File 'lib/boppers/notifier/twitter.rb', line 6 def access_secret @access_secret end |
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
6 7 8 |
# File 'lib/boppers/notifier/twitter.rb', line 6 def access_token @access_token end |
#consumer_key ⇒ Object (readonly)
Returns the value of attribute consumer_key.
6 7 8 |
# File 'lib/boppers/notifier/twitter.rb', line 6 def consumer_key @consumer_key end |
#consumer_secret ⇒ Object (readonly)
Returns the value of attribute consumer_secret.
6 7 8 |
# File 'lib/boppers/notifier/twitter.rb', line 6 def consumer_secret @consumer_secret end |
#subscribe ⇒ Object (readonly)
Returns the value of attribute subscribe.
6 7 8 |
# File 'lib/boppers/notifier/twitter.rb', line 6 def subscribe @subscribe end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/boppers/notifier/twitter.rb', line 6 def user @user end |
Instance Method Details
#call(title, message, _options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/boppers/notifier/twitter.rb', line 20 def call(title, , ) client = ::Twitter::REST::Client.new do |config| config.consumer_key = consumer_key config.consumer_secret = consumer_secret config.access_token = access_token config.access_token_secret = access_secret end body = "#{title}\n\n#{}" client.(user, body) end |