Sha256: a20c9cc92c908a03896126ef0077cfb6759947fcca8571484dfc03525ff1b00e
Contents?: true
Size: 619 Bytes
Versions: 1
Compression:
Stored size: 619 Bytes
Contents
require "oauth2" module Commercelayer class Client def initialize(options={}) @client_id = options[:client_id] @client_secret = options[:client_secret] @scope = options[:scope] @site = options[:site] Resource.site = "#{options[:site]}/api/" end def authorize! Resource.authorize_with = get_access_token end private def get_access_token(options={}) oauth2_client = OAuth2::Client.new(@client_id, @client_secret, site: @site) access_token = oauth2_client.client_credentials.get_token(scope: @scope) access_token.token end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commercelayer-0.6.0 | lib/commercelayer/client.rb |