milady-cima-api 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 770badc9b7e766d70b1bd810e3a23eeb633506e7089381645fc9f411120e5f01
4
- data.tar.gz: 51c8865ad32f35a7d01f201092ce2cec4bd852c720c7f0365ea3ee7a3ecb342a
3
+ metadata.gz: a2393c91cf9004a6e89b17a133fb6a22c1c975709ba0e2deed96de5ea7798e2b
4
+ data.tar.gz: 4587a63c10a2a296db283dd54e0f09ddf2b2fac072f0a14a1580b21e7cf2e539
5
5
  SHA512:
6
- metadata.gz: 1f007a9ff35294be16fbda5e3cdc361488dac246ac36e5b464f2dffbeee3f2493219165bb21ee46594c9df43baffb04e7399bc7ff41732259ffb86b1d187d620
7
- data.tar.gz: e1aa992031ba35dacc079451ad23e60301f2c9d5227c12e6e8e570298e4787b044e5a5205ab23f0cb0dc23487bdecb25bbb8defbcb4cba2df65a888857bd8c11
6
+ metadata.gz: 48a557304dd197103eef126d739a9d02b27a440116fa9e2e4309a56d2754c2071f291e03d165adb346ccb234a5ca71686c5c0e09f71c1c3d86fd29dbfff4e8ae
7
+ data.tar.gz: ec1b31c51524ddc83edea4fc6631b3a73bc033029450f83ccdd660bc471730e9ae5a8185cf2b144243d01d27eac9274849a17d4a2e6a3a75dfc9111856070883
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.0] - 2025-12-29
4
+ ### Added
5
+ - Added `Modules` resource under `Courses` to support `GET /courses/{id}/modules` and `GET /courses/{id}/modules/{module_id}`.
6
+
3
7
  ## [0.6.0] - 2025-12-05
4
8
  ### Added
5
9
  - Added `AssessmentGrades` resource under `Users` to support `GET /users/{id}/assessment_grades` and `GET /users/{id}/assessment_grades/{grade_id}`.
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../base'
4
+
5
+ module MiLadyCimaApi
6
+ module Resources
7
+ class Courses
8
+ # Modules resource exposes endpoints under /courses/{id}/modules
9
+ class Modules < Resources::Base
10
+
11
+ # List modules for a course
12
+ #
13
+ # GET /courses/{id}/modules
14
+ # @param course_id [Integer, String] ID of the course
15
+ # @param filter [Hash, String] Filter using JSON structure (id, start_at, begin_at, end_at, course_id, tags)
16
+ # @param include [String] Comma separated list of relationships to include (course)
17
+ # @param limit [Integer] Limit the number of returned objects (default 10, max 100)
18
+ # @param offset [Integer] Used for paging through a small dataset
19
+ # @param after [Integer] Used for fast paging by setting the value to the last object id
20
+ # @param count [Boolean] If true, just return the number of list items
21
+ # @return [Array, Hash] Parsed JSON response from the API
22
+ def list(course_id:, filter: nil, include: nil, limit: nil, offset: nil, after: nil, count: nil)
23
+ raise ArgumentError, 'course_id is required' if course_id.nil?
24
+
25
+ if limit && limit > 100
26
+ raise ArgumentError, 'limit cannot be greater than 100'
27
+ end
28
+
29
+ params = {}
30
+ params['$filter'] = normalize_filter(filter) if filter
31
+ params['$include'] = include if include
32
+ params['$limit'] = limit if limit
33
+ params['$offset'] = offset if offset
34
+ params['$after'] = after if after
35
+ params['$count'] = count if count
36
+
37
+ @client.get("/courses/#{course_id}/modules", params: params)
38
+ end
39
+
40
+ # Get a single module
41
+ #
42
+ # GET /courses/{id}/modules/{module_id}
43
+ # @param course_id [Integer, String] ID of the course
44
+ # @param module_id [Integer, String] ID of the module
45
+ # @param include [String] Comma separated list of relationships to include (course)
46
+ # @return [Hash] Parsed JSON response from the API
47
+ def find(course_id:, module_id:, include: nil)
48
+ raise ArgumentError, 'course_id is required' if course_id.nil?
49
+ raise ArgumentError, 'module_id is required' if module_id.nil?
50
+
51
+ params = {}
52
+ params['$include'] = include if include
53
+
54
+ @client.get("/courses/#{course_id}/modules/#{module_id}", params: params)
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -17,6 +17,11 @@ module MiLadyCimaApi
17
17
  @learners ||= Learners.new(@client)
18
18
  end
19
19
 
20
+ # @return [MiLadyCimaApi::Resources::Courses::Modules]
21
+ def modules
22
+ @modules ||= Modules.new(@client)
23
+ end
24
+
20
25
  # List courses
21
26
  #
22
27
  # GET /courses
@@ -96,3 +101,4 @@ end
96
101
 
97
102
  require_relative 'courses/assessments'
98
103
  require_relative 'courses/learners'
104
+ require_relative 'courses/modules'
@@ -2,5 +2,5 @@
2
2
 
3
3
  module MiLadyCimaApi
4
4
  # Gem version
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.0"
6
6
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/milady_cima_api/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "milady-cima-api"
7
+ spec.version = MiLadyCimaApi::VERSION
8
+ spec.authors = ["marcus.salinas"]
9
+ spec.email = ["12.marcus.salinas@gmail.com"]
10
+
11
+ spec.summary = "Ruby wrapper for the MiLady CIMA API."
12
+ spec.description = "milady-cima-api is a lightweight Ruby client that wraps the MiLady CIMA API, providing simple, idiomatic access to its endpoints."
13
+ spec.homepage = "https://github.com/jippylong12/milady-cima-api"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/jippylong12/milady-cima-api"
21
+ spec.metadata["changelog_uri"] = "https://github.com/jippylong12/milady-cima-api/blob/main/CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (File.expand_path(f) == __FILE__) ||
28
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
29
+ end
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ # Uncomment to register a new dependency of your gem
36
+ # spec.add_dependency "example-gem", "~> 1.0"
37
+
38
+ # For more information and examples about making a new gem, check out our
39
+ # guide at: https://bundler.io/guides/creating_gem.html
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milady-cima-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - marcus.salinas
@@ -32,11 +32,13 @@ files:
32
32
  - lib/milady_cima_api/resources/courses/assessments.rb
33
33
  - lib/milady_cima_api/resources/courses/assessments/grades.rb
34
34
  - lib/milady_cima_api/resources/courses/learners.rb
35
+ - lib/milady_cima_api/resources/courses/modules.rb
35
36
  - lib/milady_cima_api/resources/organizations.rb
36
37
  - lib/milady_cima_api/resources/users.rb
37
38
  - lib/milady_cima_api/resources/users/assessment_grades.rb
38
39
  - lib/milady_cima_api/resources/users/course_learners.rb
39
40
  - lib/milady_cima_api/version.rb
41
+ - milady-cima-api.gemspec
40
42
  homepage: https://github.com/jippylong12/milady-cima-api
41
43
  licenses:
42
44
  - MIT