Class: Myun2::Twitter::Authenticate

Inherits:
Object
  • Object
show all
Defined in:
lib/myun2/twitter/authenticate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Authenticate

Returns a new instance of Authenticate.



8
9
10
# File 'lib/myun2/twitter/authenticate.rb', line 8

def initialize(params)
  @client = TwitterOAuth::Client.new(params)
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



6
7
8
# File 'lib/myun2/twitter/authenticate.rb', line 6

def access_token
  @access_token
end

#authorize_urlObject (readonly)

Returns the value of attribute authorize_url.



6
7
8
# File 'lib/myun2/twitter/authenticate.rb', line 6

def authorize_url
  @authorize_url
end

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/myun2/twitter/authenticate.rb', line 6

def client
  @client
end

Instance Method Details

#authorize(pin_code) ⇒ Object



17
18
19
20
# File 'lib/myun2/twitter/authenticate.rb', line 17

def authorize(pin_code)
  @access_token = client.authorize(
    @token.token, @token.secret, oauth_verifier: pin_code)
end

#request_authorize_urlObject



12
13
14
15
# File 'lib/myun2/twitter/authenticate.rb', line 12

def request_authorize_url
  @token = client.authentication_request_token(oauth_callback: 'oob')
  @authorize_url = @token.authorize_url
end