credly-ruby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile +2 -2
- data/Gemfile.lock +33 -22
- data/README.md +1 -0
- data/Rakefile +3 -3
- data/lib/{credly → credly-ruby}/client.rb +8 -8
- data/lib/{credly → credly-ruby}/connection.rb +7 -6
- data/lib/{credly → credly-ruby}/error.rb +2 -1
- data/lib/{credly → credly-ruby}/version.rb +1 -1
- data/lib/credly-ruby.rb +14 -0
- metadata +16 -19
- data/lib/credly_ruby.rb +0 -12
- /data/lib/{credly → credly-ruby}/actions/badge_templates.rb +0 -0
- /data/lib/{credly → credly-ruby}/actions/badges.rb +0 -0
- /data/lib/{credly → credly-ruby}/actions/issuer_authorizations.rb +0 -0
- /data/lib/{credly → credly-ruby}/actions/obi.rb +0 -0
- /data/lib/{credly → credly-ruby}/actions/organizations.rb +0 -0
- /data/lib/{credly → credly-ruby}/actions/workforce.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a2685f444e40a2028769ed8ea3bacf7eb073764b5ea93decaee69bcbb123ae2
|
4
|
+
data.tar.gz: 9af003eb5e1971f8ea2a6a30863d080c4e64c85ef8d1cf3f5b9f41f3d02fb6b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 474c149d0d188a1098b39699c1ddbb8036ec1f0b4bb11dbe8968147be85076b49f334989d0caec9dc8a4a981da5e076c85ad705c9e07957f2386b061485095a8
|
7
|
+
data.tar.gz: 4639b4f7a0f9249e5638e9cbe1b70ee7c546912f2d1007e6aa585889609e1601e40bb1f34001b933aef6b2d90f5d8fd801889d0f08792dd368eb4384b604cf73
|
data/.rspec
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
## v0.2.0
|
2
|
+
|
3
|
+
- Changed to Farady 1.0
|
4
|
+
|
1
5
|
## v0.1.0
|
2
6
|
|
3
7
|
Initial release of the gem.
|
4
8
|
|
5
9
|
- Added badge endpoints
|
6
10
|
- Added badge template endpoints
|
7
|
-
- Added organization endpoints
|
8
11
|
- Added obi endpoints
|
9
|
-
- Added
|
12
|
+
- Added organization endpoints
|
13
|
+
- Added workforce endpoints
|
10
14
|
|
11
15
|
## [Unreleased]
|
data/Gemfile
CHANGED
@@ -4,13 +4,13 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'faraday', '~>
|
7
|
+
gem 'faraday', '~> 1.0', '>= 1.0.0'
|
8
8
|
|
9
9
|
group :development, :test do
|
10
|
+
gem 'rake', '~> 13.0.6'
|
10
11
|
gem 'rspec', '~> 3.12.0'
|
11
12
|
gem 'rspec_junit_formatter', '~> 0.6.0'
|
12
13
|
gem 'rubocop', '~> 1.52.1'
|
13
14
|
gem 'rubocop-rspec', '~> 2.22.0'
|
14
|
-
gem 'simplecov'
|
15
15
|
gem 'webmock', '~> 3.18.1'
|
16
16
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
credly-ruby (0.
|
4
|
+
credly-ruby (0.2.0)
|
5
|
+
faraday (~> 1.0, >= 1.0.0)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
@@ -9,26 +10,44 @@ GEM
|
|
9
10
|
addressable (2.8.5)
|
10
11
|
public_suffix (>= 2.0.2, < 6.0)
|
11
12
|
ast (2.4.2)
|
12
|
-
base64 (0.1.1)
|
13
13
|
crack (0.4.5)
|
14
14
|
rexml
|
15
15
|
diff-lcs (1.5.0)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
faraday-
|
16
|
+
faraday (1.10.3)
|
17
|
+
faraday-em_http (~> 1.0)
|
18
|
+
faraday-em_synchrony (~> 1.0)
|
19
|
+
faraday-excon (~> 1.1)
|
20
|
+
faraday-httpclient (~> 1.0)
|
21
|
+
faraday-multipart (~> 1.0)
|
22
|
+
faraday-net_http (~> 1.0)
|
23
|
+
faraday-net_http_persistent (~> 1.0)
|
24
|
+
faraday-patron (~> 1.0)
|
25
|
+
faraday-rack (~> 1.0)
|
26
|
+
faraday-retry (~> 1.0)
|
20
27
|
ruby2_keywords (>= 0.0.4)
|
21
|
-
faraday-
|
28
|
+
faraday-em_http (1.0.0)
|
29
|
+
faraday-em_synchrony (1.0.0)
|
30
|
+
faraday-excon (1.1.0)
|
31
|
+
faraday-httpclient (1.0.1)
|
32
|
+
faraday-multipart (1.0.4)
|
33
|
+
multipart-post (~> 2)
|
34
|
+
faraday-net_http (1.0.1)
|
35
|
+
faraday-net_http_persistent (1.2.0)
|
36
|
+
faraday-patron (1.0.0)
|
37
|
+
faraday-rack (1.0.0)
|
38
|
+
faraday-retry (1.0.3)
|
22
39
|
hashdiff (1.0.1)
|
23
40
|
json (2.6.3)
|
41
|
+
multipart-post (2.3.0)
|
24
42
|
parallel (1.23.0)
|
25
|
-
parser (3.2.2.
|
43
|
+
parser (3.2.2.4)
|
26
44
|
ast (~> 2.4.1)
|
27
45
|
racc
|
28
46
|
public_suffix (5.0.3)
|
29
47
|
racc (1.7.1)
|
30
48
|
rainbow (3.1.1)
|
31
|
-
|
49
|
+
rake (13.0.6)
|
50
|
+
regexp_parser (2.8.2)
|
32
51
|
rexml (3.2.6)
|
33
52
|
rspec (3.12.0)
|
34
53
|
rspec-core (~> 3.12.0)
|
@@ -57,9 +76,9 @@ GEM
|
|
57
76
|
unicode-display_width (>= 2.4.0, < 3.0)
|
58
77
|
rubocop-ast (1.29.0)
|
59
78
|
parser (>= 3.2.1.0)
|
60
|
-
rubocop-capybara (2.
|
79
|
+
rubocop-capybara (2.19.0)
|
61
80
|
rubocop (~> 1.41)
|
62
|
-
rubocop-factory_bot (2.
|
81
|
+
rubocop-factory_bot (2.24.0)
|
63
82
|
rubocop (~> 1.33)
|
64
83
|
rubocop-rspec (2.22.0)
|
65
84
|
rubocop (~> 1.33)
|
@@ -67,31 +86,23 @@ GEM
|
|
67
86
|
rubocop-factory_bot (~> 2.22)
|
68
87
|
ruby-progressbar (1.13.0)
|
69
88
|
ruby2_keywords (0.0.5)
|
70
|
-
|
71
|
-
docile (~> 1.1)
|
72
|
-
simplecov-html (~> 0.11)
|
73
|
-
simplecov_json_formatter (~> 0.1)
|
74
|
-
simplecov-html (0.12.3)
|
75
|
-
simplecov_json_formatter (0.1.4)
|
76
|
-
unicode-display_width (2.4.2)
|
89
|
+
unicode-display_width (2.5.0)
|
77
90
|
webmock (3.18.1)
|
78
91
|
addressable (>= 2.8.0)
|
79
92
|
crack (>= 0.3.2)
|
80
93
|
hashdiff (>= 0.4.0, < 2.0.0)
|
81
94
|
|
82
95
|
PLATFORMS
|
83
|
-
x64-mingw-ucrt
|
84
|
-
x86_64-darwin-21
|
85
96
|
x86_64-linux
|
86
97
|
|
87
98
|
DEPENDENCIES
|
88
99
|
credly-ruby!
|
89
|
-
faraday (~>
|
100
|
+
faraday (~> 1.0, >= 1.0.0)
|
101
|
+
rake (~> 13.0.6)
|
90
102
|
rspec (~> 3.12.0)
|
91
103
|
rspec_junit_formatter (~> 0.6.0)
|
92
104
|
rubocop (~> 1.52.1)
|
93
105
|
rubocop-rspec (~> 2.22.0)
|
94
|
-
simplecov
|
95
106
|
webmock (~> 3.18.1)
|
96
107
|
|
97
108
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/credly-ruby.svg)](https://badge.fury.io/rb/credly-ruby)
|
1
2
|
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/riipen/credly-ruby/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/riipen/credly-ruby/tree/main)
|
2
3
|
|
3
4
|
# Credly Ruby
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
@@ -15,12 +15,12 @@ module Credly
|
|
15
15
|
BASE_URL_S = 'https://sandbox-api.credly.com'
|
16
16
|
|
17
17
|
def initialize(auth_token:, version: 'v1', sandbox: false)
|
18
|
-
@base_url
|
19
|
-
@url
|
20
|
-
@version
|
21
|
-
@auth_token
|
22
|
-
@sandbox
|
23
|
-
@connection
|
18
|
+
@base_url = sandbox ? BASE_URL_S : BASE_URL_P
|
19
|
+
@url = [@base_url, version].join('/')
|
20
|
+
@version = version
|
21
|
+
@auth_token = auth_token
|
22
|
+
@sandbox = sandbox
|
23
|
+
@connection = Connection.new(@url, @auth_token)
|
24
24
|
end
|
25
25
|
|
26
26
|
def connection
|
@@ -28,8 +28,8 @@ module Credly
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def auth_token=(auth_token)
|
31
|
-
@auth_token
|
32
|
-
@connection.auth_token
|
31
|
+
@auth_token = auth_token
|
32
|
+
@connection.auth_token = auth_token
|
33
33
|
end
|
34
34
|
|
35
35
|
def base_url
|
@@ -5,11 +5,10 @@ require 'faraday'
|
|
5
5
|
module Credly
|
6
6
|
class Connection
|
7
7
|
def initialize(url, auth_token)
|
8
|
-
@connection = Faraday.new(url: url) do |
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
builder.request :authorization, :basic, auth_token, ''
|
8
|
+
@connection = Faraday.new(url: url) do |conn|
|
9
|
+
conn.request :json
|
10
|
+
conn.response :json
|
11
|
+
conn.request :basic_auth, auth_token, ''
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
@@ -34,7 +33,9 @@ module Credly
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def request(method, path, params)
|
37
|
-
response = @connection.
|
36
|
+
response = @connection.public_send(method, path, params) do |request|
|
37
|
+
request.headers[:accept] = 'application/json'
|
38
|
+
end
|
38
39
|
|
39
40
|
error = Error.from_response(response)
|
40
41
|
|
@@ -24,6 +24,7 @@ module Credly
|
|
24
24
|
|
25
25
|
def initialize(response = nil)
|
26
26
|
@response = response
|
27
|
+
|
27
28
|
super(build_error_message)
|
28
29
|
end
|
29
30
|
|
@@ -32,7 +33,7 @@ module Credly
|
|
32
33
|
def build_error_message
|
33
34
|
return nil if @response.nil?
|
34
35
|
|
35
|
-
@response.body
|
36
|
+
@response.body.dig('data', 'message')
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
data/lib/credly-ruby.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
4
|
+
|
5
|
+
require 'credly-ruby/actions/badges'
|
6
|
+
require 'credly-ruby/actions/badge_templates'
|
7
|
+
require 'credly-ruby/actions/organizations'
|
8
|
+
require 'credly-ruby/actions/obi'
|
9
|
+
require 'credly-ruby/actions/issuer_authorizations'
|
10
|
+
require 'credly-ruby/actions/workforce'
|
11
|
+
require 'credly-ruby/client'
|
12
|
+
require 'credly-ruby/connection'
|
13
|
+
require 'credly-ruby/error'
|
14
|
+
require 'credly-ruby/version'
|
metadata
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credly-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Elijah Almacen
|
9
|
-
- ChanSokphanavy Plean
|
10
|
-
- Yahui Qin
|
11
|
-
- Shuning Xu
|
7
|
+
- Jordan Ell
|
12
8
|
autorequire:
|
13
9
|
bindir: exe
|
14
10
|
cert_chain: []
|
15
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
16
12
|
dependencies:
|
17
13
|
- !ruby/object:Gem::Dependency
|
18
14
|
name: faraday
|
@@ -40,6 +36,7 @@ executables: []
|
|
40
36
|
extensions: []
|
41
37
|
extra_rdoc_files: []
|
42
38
|
files:
|
39
|
+
- ".rspec"
|
43
40
|
- ".rubocop.yml"
|
44
41
|
- CHANGELOG.md
|
45
42
|
- Gemfile
|
@@ -47,17 +44,17 @@ files:
|
|
47
44
|
- LICENSE
|
48
45
|
- README.md
|
49
46
|
- Rakefile
|
50
|
-
- lib/credly
|
51
|
-
- lib/credly/actions/
|
52
|
-
- lib/credly/actions/
|
53
|
-
- lib/credly/actions/
|
54
|
-
- lib/credly/actions/
|
55
|
-
- lib/credly/actions/
|
56
|
-
- lib/credly/
|
57
|
-
- lib/credly/
|
58
|
-
- lib/credly/
|
59
|
-
- lib/credly/
|
60
|
-
- lib/
|
47
|
+
- lib/credly-ruby.rb
|
48
|
+
- lib/credly-ruby/actions/badge_templates.rb
|
49
|
+
- lib/credly-ruby/actions/badges.rb
|
50
|
+
- lib/credly-ruby/actions/issuer_authorizations.rb
|
51
|
+
- lib/credly-ruby/actions/obi.rb
|
52
|
+
- lib/credly-ruby/actions/organizations.rb
|
53
|
+
- lib/credly-ruby/actions/workforce.rb
|
54
|
+
- lib/credly-ruby/client.rb
|
55
|
+
- lib/credly-ruby/connection.rb
|
56
|
+
- lib/credly-ruby/error.rb
|
57
|
+
- lib/credly-ruby/version.rb
|
61
58
|
homepage: https://github.com/riipen/credly-ruby
|
62
59
|
licenses:
|
63
60
|
- MIT
|
@@ -81,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
78
|
- !ruby/object:Gem::Version
|
82
79
|
version: '0'
|
83
80
|
requirements: []
|
84
|
-
rubygems_version: 3.3.
|
81
|
+
rubygems_version: 3.3.26
|
85
82
|
signing_key:
|
86
83
|
specification_version: 4
|
87
84
|
summary: An API client for Credly in ruby.
|
data/lib/credly_ruby.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'credly/connection'
|
4
|
-
require 'credly/actions/badges'
|
5
|
-
require 'credly/actions/badge_templates'
|
6
|
-
require 'credly/actions/organizations'
|
7
|
-
require 'credly/actions/obi'
|
8
|
-
require 'credly/actions/issuer_authorizations'
|
9
|
-
require 'credly/actions/workforce'
|
10
|
-
require 'credly/client'
|
11
|
-
require 'credly/error'
|
12
|
-
require 'credly/version'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|