Class: Hermes::TwitterProvider

Inherits:
Provider
  • Object
show all
Defined in:
lib/providers/twitter/twitter_provider.rb

Instance Attribute Summary

Attributes inherited from Provider

#credentials, #defaults, #deliverer, #weight

Instance Method Summary collapse

Methods inherited from Provider

#initialize, #message_failure, #message_success, #provider_name, required_credentials

Methods included from Extractors

#complex_extract, #extract_from, #extract_html, #extract_text, #extract_to

Constructor Details

This class inherits a constructor from Hermes::Provider

Instance Method Details

#client(rails_message) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/providers/twitter/twitter_provider.rb', line 9

def client(rails_message)
  # this will already be an instance of Twitter::client
  client = extract_to(rails_message)

  # just need to set the consumer key and secret and
  # then we'll be ready for liftoff
  client.consumer_key = self.credentials[:consumer_key]
  client.consumer_secret = self.credentials[:consumer_secret]

  return client
end

#send_message(rails_message) ⇒ Object



5
6
7
# File 'lib/providers/twitter/twitter_provider.rb', line 5

def send_message(rails_message)
  self.client(rails_message).update(extract_text(rails_message))
end