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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 06d51d926108dd5346c76fef1cadccbab0a5562148584c9cd0690d70ec3fa74f
4
- data.tar.gz: f729273b840ecd2fa1203d62e70469ee587db14bc838b9fd3c38eed129ad5c68
2
+ SHA1:
3
+ metadata.gz: 37dd2c26775f1c3035feb0d60552ab6a63fe3341
4
+ data.tar.gz: 2edf6118c28a4e7e0239d0b89d5ea253ba4bfae3
5
5
  SHA512:
6
- metadata.gz: 93cdc3c103461b105feb8a8a1888123bd8acae73766ef9b320a89076fe8e2f958ee86960c88a8dea6b367ec77251d5dbb30b6c82039facb95a83d4510f5088e4
7
- data.tar.gz: 27d77286be638ae940333a831abbdaae44733a807a608d99d6ecbdf4e144efbc87f9f0054b773bbcb7c0bba6d71378d0403e55f1e6f92b629dbf44d33d04a7e0
6
+ metadata.gz: e4b81910d5b719ff72decf3c981b5e60c6fe75e1cdaa89cc3651ac320bee6be7524fbc45f32ba54eb07038e8067a932ee6dd5438200cebe159079a8556905d77
7
+ data.tar.gz: 6f3cc15958e3819da10947f10cd2262e85ad73cdaaaa718a3eff557e9301af32351e1757ecb858c860028aa3ee774956dc9c76ea86b4c90039795c012559b8a6
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.3.1
2
+ * Add support for connecting to sandbox environment
3
+ * Add checks for nil parameters
4
+
1
5
  v0.3.0
2
6
  * Added PoC code for supporting v3 API based on GraphQL
3
7
  * Added some common schemas and v3 schema
@@ -20,6 +20,8 @@ class Learndot
20
20
  attr_reader :api
21
21
 
22
22
  def initialize(debug = false, staging = false)
23
+ debug ||= false
24
+ staging ||= false
23
25
  @api = Learndot::API.new(nil, debug, staging)
24
26
  end
25
27
 
@@ -12,10 +12,19 @@ class Learndot::API
12
12
  "#{level}: #{msg}\n"
13
13
  }
14
14
 
15
- token ||= get_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
- @base_url = staging ? "https://puppetlabs-staging.trainingrocket.com/api/rest/v2" : "https://learn.puppet.com/api/rest/v2"
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.0
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-02-07 00:00:00.000000000 Z
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: Methods to retrieve records from Learndot Enterprise API
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: http://learn.puppet.com
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.7.3
69
+ rubygems_version: 2.6.14
67
70
  signing_key:
68
71
  specification_version: 4
69
72
  summary: Learndot API