lib/sk_sdk/oauth.rb in sk_sdk-0.1.0 vs lib/sk_sdk/oauth.rb in sk_sdk-0.1.1
- old
+ new
@@ -17,12 +17,12 @@
# == Options(opts)
# id<String>:: oAuth app id from SalesKing app registration
# secret<String>:: oAuth app secret from SalesKing app registration
# scope<String>:: permission your app requests
# redirect_url<String>:: redirect url inside your app for auth dialog
- # sk_url<String>:: SalesKing base url, * is replaced with users subdomain,
- # default https://*.salesking.eu, optional
+ # sk_url<String>:: SalesKing base url, * is replaced with users subdomain,
+ # no trailing slash, optional defaults to https://*.salesking.eu
# sub_domain<String>:: optinal, will probably be set later after a users
# provided his subdomain
def initialize(opts)
@id = opts['id']
@secret = opts['secret']
@@ -70,9 +70,16 @@
# access token
def get_token(code)
c = Curl::Easy.perform( token_url( code ) )
# grab token from response body, containing json string
ActiveSupport::JSON.decode(c.body_str)
+ end
+
+ # The API url ist the salesking url of the current company + /api
+ # === Returns
+ # <String>:: base api url my-sub.salesking.eu/api
+ def sk_api_url
+ "#{sk_url}/api"
end
# Each company has it's own subdomain so the url must be dynamic.
# This is achieved by replacing the * with the subdomain in the instance
# === Returns
\ No newline at end of file