Class: Twitty::Facade

Inherits:
Object
  • Object
show all
Includes:
Constants, Payload
Defined in:
lib/twitty/facade.rb

Constant Summary

Constants included from Payload

Payload::EMPTY_PAYLOAD_ACTIONS

Constants included from Constants

Constants::API_CONFIG

Instance Method Summary collapse

Methods included from Payload

#access_token_payload, #build_payload, #like_tweet_payload, #request_oauth_token_payload, #send_direct_message_payload, #send_tweet_reply_payload, #unlike_tweet_payload

Constructor Details

#initialize {|config| ... } ⇒ Facade

Returns a new instance of Facade.

Yields:

  • (config)


7
8
9
# File 'lib/twitty/facade.rb', line 7

def initialize
  yield(config) if block_given?
end

Instance Method Details

#generate_crc(crc_token) ⇒ Object



17
18
19
20
# File 'lib/twitty/facade.rb', line 17

def generate_crc(crc_token)
  hash = OpenSSL::HMAC.digest('sha256', config.consumer_secret, crc_token)
  Base64.encode64(hash).strip!
end

#override_client_tokens(access_token, access_token_secret) ⇒ Object



22
23
24
25
# File 'lib/twitty/facade.rb', line 22

def override_client_tokens(access_token, access_token_secret)
  config.access_token = access_token
  config.access_token_secret = access_token_secret
end