Method: Weibo2::Client.from_code

Defined in:
lib/weibo2/client.rb

.from_code(code, opts = {}) {|builder| ... } ⇒ Object

Initializes a new Client from a signed_request

Parameters:

  • code (String)

    The Authorization Code value

  • opts (Hash) (defaults to: {})

    the options to create the client with

Options Hash (opts):

  • :connection_opts (Hash) — default: {}

    Hash of connection options to pass to initialize Faraday with

  • :max_redirects (FixNum) — default: 5

    maximum number of redirects to follow

Yields:

  • (builder)

    The Faraday connection builder



18
19
20
21
22
23
# File 'lib/weibo2/client.rb', line 18

def self.from_code(code, opts={}, &block)
  client = self.new(opts, &block)
  client.auth_code.get_token(code)
  
  client
end