Class: Credly::Client
- Inherits:
-
Object
- Object
- Credly::Client
- Includes:
- Actions::BadgeTemplates, Actions::Badges, Actions::IssuerAuthorizations, Actions::OBI, Actions::Organizations, Actions::Workforce
- Defined in:
- lib/credly-ruby/client.rb
Constant Summary collapse
- BASE_URL_P =
'https://api.credly.com'- BASE_URL_S =
'https://sandbox-api.credly.com'
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #base_url ⇒ Object
- #connection ⇒ Object
-
#initialize(auth_token:, version: 'v1', sandbox: false) ⇒ Client
constructor
A new instance of Client.
Methods included from Actions::Workforce
#employee_create, #employee_data_api_get, #employee_delete, #employee_get, #employee_invite, #employee_list, #employee_update
Methods included from Actions::IssuerAuthorizations
#grantor_list, #issuer_deauthorize, #issuer_list
Methods included from Actions::OBI
#obi_badge_assertion_get, #obi_badge_class_get, #obi_issuer_get
Methods included from Actions::Organizations
#organization_event_get, #organization_event_list, #organization_get, #organization_tokens_list, #organization_update, #organizations_list
Methods included from Actions::BadgeTemplates
#badge_template_get, #badge_templates_list
Methods included from Actions::Badges
#badge_delete, #badge_issue, #badge_list, #badge_list_bulk, #badge_replace, #badge_revoke
Constructor Details
#initialize(auth_token:, version: 'v1', sandbox: false) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 24 |
# File 'lib/credly-ruby/client.rb', line 17 def initialize(auth_token:, version: 'v1', sandbox: false) @base_url = sandbox ? BASE_URL_S : BASE_URL_P @url = [@base_url, version].join('/') @version = version @auth_token = auth_token @sandbox = sandbox @connection = Connection.new(@url, @auth_token) end |
Instance Attribute Details
#auth_token ⇒ Object
Returns the value of attribute auth_token.
11 12 13 |
# File 'lib/credly-ruby/client.rb', line 11 def auth_token @auth_token end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
12 13 14 |
# File 'lib/credly-ruby/client.rb', line 12 def sandbox @sandbox end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/credly-ruby/client.rb', line 11 def url @url end |
Instance Method Details
#base_url ⇒ Object
35 36 37 |
# File 'lib/credly-ruby/client.rb', line 35 def base_url @sandbox ? BASE_URL_S : BASE_URL_P end |
#connection ⇒ Object
26 27 28 |
# File 'lib/credly-ruby/client.rb', line 26 def connection @connection ||= Connection.new(@url, @auth_token) end |