Class: Weibo2::Strategy::SignedRequest

Inherits:
OAuth2::Strategy::Base
  • Object
show all
Defined in:
lib/weibo2/strategy/signed_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#unsigned_requestObject (readonly)

Returns the value of attribute unsigned_request.



4
5
6
# File 'lib/weibo2/strategy/signed_request.rb', line 4

def unsigned_request
  @unsigned_request
end

Instance Method Details

#authorize_urlObject

Not used for this strategy

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/weibo2/strategy/signed_request.rb', line 9

def authorize_url
  raise NotImplementedError, "The authorization endpoint is not used in this strategy"
end

#get_token(signed_request) ⇒ Object

Retrieve an access token given the specified signed_request.

Parameters:

  • signed_request (String)


16
17
18
19
20
21
22
# File 'lib/weibo2/strategy/signed_request.rb', line 16

def get_token(signed_request)
  data = parse_signed_request(signed_request)
  unless ["-1", "-2"].include? data
    @unsigned_request = data
    @client.get_token_from_hash(data)
  end
end