Class: Metalbird::Twitter::Authentication

Inherits:
Object
  • Object
show all
Defined in:
lib/metalbird/twitter/authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Authentication


8
9
10
11
12
13
14
15
16
17
# File 'lib/metalbird/twitter/authentication.rb', line 8

def initialize(opts = {})
  assert_opts(opts)

  @client = ::Twitter::REST::Client.new do |config|
    config.consumer_key = opts[:consumer_key]
    config.consumer_secret = opts[:consumer_secret]
    config.access_token = opts[:access_token]
    config.access_token_secret = opts[:access_token_secret]
  end
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client


6
7
8
# File 'lib/metalbird/twitter/authentication.rb', line 6

def client
  @client
end

Instance Method Details

#assert_opts(opts) ⇒ Object


19
20
21
# File 'lib/metalbird/twitter/authentication.rb', line 19

def assert_opts(opts)
  fail ArgumentError unless validate_opts(opts)
end