learndot_api 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +4 -0
- data/{lib/learndot/schema.json → examples/v3_schema.json} +0 -0
- data/lib/learndot.rb +2 -0
- data/lib/learndot/api.rb +11 -2
- data/lib/learndot/entity.rb +23 -0
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37dd2c26775f1c3035feb0d60552ab6a63fe3341
|
4
|
+
data.tar.gz: 2edf6118c28a4e7e0239d0b89d5ea253ba4bfae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4b81910d5b719ff72decf3c981b5e60c6fe75e1cdaa89cc3651ac320bee6be7524fbc45f32ba54eb07038e8067a932ee6dd5438200cebe159079a8556905d77
|
7
|
+
data.tar.gz: 6f3cc15958e3819da10947f10cd2262e85ad73cdaaaa718a3eff557e9301af32351e1757ecb858c860028aa3ee774956dc9c76ea86b4c90039795c012559b8a6
|
data/CHANGELOG
CHANGED
File without changes
|
data/lib/learndot.rb
CHANGED
data/lib/learndot/api.rb
CHANGED
@@ -12,10 +12,19 @@ class Learndot::API
|
|
12
12
|
"#{level}: #{msg}\n"
|
13
13
|
}
|
14
14
|
|
15
|
-
token
|
15
|
+
token ||= get_token
|
16
|
+
debug ||= false
|
17
|
+
staging ||= false
|
16
18
|
|
17
19
|
# Set the base_url to the staging or production endpoint
|
18
|
-
|
20
|
+
case staging
|
21
|
+
when 'production', false
|
22
|
+
@base_url = "https://learn.puppet.com/api/rest/v2"
|
23
|
+
when 'staging', true
|
24
|
+
@base_url = "https://puppetlabs-staging.trainingrocket.com/api/rest/v2"
|
25
|
+
when 'sandbox'
|
26
|
+
@base_url = "https://puppetlabs-sandbox.trainingrocket.com/api/rest/v2"
|
27
|
+
end
|
19
28
|
|
20
29
|
@headers = {
|
21
30
|
"TrainingRocket-Authorization" => token,
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Learndot::Entity
|
2
|
+
def initialize(api)
|
3
|
+
@api = api
|
4
|
+
end
|
5
|
+
|
6
|
+
def retrieve(entity_name, conditions, options = {orderBy: 'Name', asc: true})
|
7
|
+
entity = @api.search(entity_name, conditions, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def create(entity_name, conditions)
|
11
|
+
@api.create(entity_name, conditions)
|
12
|
+
end
|
13
|
+
|
14
|
+
def update(entity_name, component_id, conditions={})
|
15
|
+
@api.update(entity_name, conditions, component_id)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Learndot
|
20
|
+
def entity
|
21
|
+
Learndot::Entity.new(self.api)
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learndot_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Marrero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -24,7 +24,9 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.13.7
|
27
|
-
description:
|
27
|
+
description: |2
|
28
|
+
Puppet uses this gem to interact with the Learndot API. It may also
|
29
|
+
work for your purposes, but we make no promises.
|
28
30
|
email: michael.marrero@puppet.com
|
29
31
|
executables: []
|
30
32
|
extensions: []
|
@@ -35,15 +37,16 @@ files:
|
|
35
37
|
- examples/learning_component_desc.json
|
36
38
|
- examples/test.rb
|
37
39
|
- examples/v2_endpoints.json
|
40
|
+
- examples/v3_schema.json
|
38
41
|
- lib/learndot.rb
|
39
42
|
- lib/learndot/api.rb
|
40
43
|
- lib/learndot/apiv3.rb
|
41
44
|
- lib/learndot/courses.rb
|
45
|
+
- lib/learndot/entity.rb
|
42
46
|
- lib/learndot/events.rb
|
43
47
|
- lib/learndot/learning_components.rb
|
44
|
-
- lib/learndot/schema.json
|
45
48
|
- lib/learndot/training_credits.rb
|
46
|
-
homepage:
|
49
|
+
homepage: https://github.com/puppetlabs/learndot_api
|
47
50
|
licenses:
|
48
51
|
- MIT
|
49
52
|
metadata: {}
|
@@ -63,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
66
|
version: '0'
|
64
67
|
requirements: []
|
65
68
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.
|
69
|
+
rubygems_version: 2.6.14
|
67
70
|
signing_key:
|
68
71
|
specification_version: 4
|
69
72
|
summary: Learndot API
|