milady-cima-api 0.1.0 → 0.2.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: 5539419d40c122e538f50af35e0be9230c3b9e29343ae9afaf47ecc18164cc25
4
- data.tar.gz: 175f19d66fd55269468793c5d7ae9eb2eb5b1adf6c874e35f28ca0a7cbf431e7
3
+ metadata.gz: dd05960749c0262fe3d556d454389a4183d248dc4a89b87828527ae343c77b6a
4
+ data.tar.gz: 00e6c1fc23a40ba8b5211e85f5fa2cf946bca67cc5086db91b5fc4ad557cf178
5
5
  SHA512:
6
- metadata.gz: 6b14b31072de9c2678cae2938c5de0dc6ba0feb1d9c2571a51db638c6bd740c04eb93d7f6972a40edd31cd07575446d74ad4fdaab401eb8d0bf28bfb70e08ccd
7
- data.tar.gz: 63c8e1ec423e9abf96e7a9b3be440e38d3a0a642eb4a76102d3440e5a5da08b3cc3ad577a721f0de455071ec5e4ab6eea71d870cb90d0a53e1a0e279eb03b666
6
+ metadata.gz: 20976e6b55d286b1b422cbd7dfef4ed1492bcb434012a55986ac17df905d7dbcb4403f2756bb70437a8f41896d37d305501769c25a757df5b72163b7d4d52afb
7
+ data.tar.gz: 668252325045549f3ccc9329b8c9823bb13e1cec9031689cc63cc6852c5f028c72e06b3df563ade3245b6bb7bac16882f2f2b1f44b8106c6c3d8fce5caa956fe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2025-12-04
4
+
5
+ ### Added
6
+ - Added `Assessments` resource under `Courses` to support `GET /courses/{id}/assessments` and `GET /courses/{id}/assessments/{assessment_id}`.
7
+ - Standardized query parameters for `Assessments#list` with validation.
8
+
3
9
  ## [0.1.0] - 2025-10-06
4
10
 
5
11
  - Initial release
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MiLadyCimaApi
4
+ module Resources
5
+ class Courses
6
+ # Assessments resource exposes endpoints under /courses/{id}/assessments
7
+ class Assessments
8
+ # @param client [MiLadyCimaApi::Client]
9
+ def initialize(client)
10
+ @client = client
11
+ end
12
+
13
+ # List assessments for a course
14
+ #
15
+ # GET /courses/{id}/assessments
16
+ # @param course_id [Integer, String] ID of the course
17
+ # @param filter [Hash, String] Filter using JSON structure
18
+ # @param limit [Integer] Limit the number of returned objects (default 10, max 100)
19
+ # @param offset [Integer] Used for paging through a small dataset
20
+ # @param after [Integer] Used for fast paging
21
+ # @param count [Boolean] If true, just return the number of list items
22
+ # @return [Array, Hash] Parsed JSON response from the API
23
+ def list(course_id:, filter: nil, limit: nil, offset: nil, after: nil, count: nil)
24
+ raise ArgumentError, 'course_id is required' if course_id.nil?
25
+
26
+ if limit && limit > 100
27
+ raise ArgumentError, 'limit cannot be greater than 100'
28
+ end
29
+
30
+ params = {}
31
+ params['$filter'] = normalize_filter(filter) if filter
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}/assessments", params: params)
38
+ end
39
+
40
+ # Get a single assessment
41
+ #
42
+ # GET /courses/{id}/assessments/{assessment_id}
43
+ # @param course_id [Integer, String] ID of the course
44
+ # @param assessment_id [Integer, String] ID of the assessment
45
+ # @return [Hash] Parsed JSON response from the API
46
+ def find(course_id:, assessment_id:)
47
+ raise ArgumentError, 'course_id is required' if course_id.nil?
48
+ raise ArgumentError, 'assessment_id is required' if assessment_id.nil?
49
+
50
+ @client.get("/courses/#{course_id}/assessments/#{assessment_id}")
51
+ end
52
+
53
+ private
54
+
55
+ def normalize_filter(filter)
56
+ return filter if filter.is_a?(String)
57
+ return JSON.generate(filter) if filter.is_a?(Hash)
58
+
59
+ raise ArgumentError, 'filter must be a String (JSON) or a Hash'
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require_relative 'courses/assessments'
4
5
 
5
6
  module MiLadyCimaApi
6
7
  module Resources
@@ -12,6 +13,11 @@ module MiLadyCimaApi
12
13
  @client = client
13
14
  end
14
15
 
16
+ # @return [MiLadyCimaApi::Resources::Courses::Assessments]
17
+ def assessments
18
+ @assessments ||= Assessments.new(@client)
19
+ end
20
+
15
21
  # List courses
16
22
  #
17
23
  # GET /courses
@@ -23,7 +29,7 @@ module MiLadyCimaApi
23
29
  # @return [Array, Hash] Parsed JSON response from the API
24
30
  # @raise [MiLadyCimaApi::UnauthorizedError, MiLadyCimaApi::NotFoundError, MiLadyCimaApi::ClientError, MiLadyCimaApi::ServerError]
25
31
  def list(params = {})
26
- params = params.dup || {}
32
+ params = params.dup || {} || {}
27
33
  normalize_filter_param!(params)
28
34
  @client.get('/courses', params: params)
29
35
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module MiLadyCimaApi
4
4
  # Gem version
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milady-cima-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - marcus.salinas
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-10-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: milady-cima-api is a lightweight Ruby client that wraps the MiLady CIMA
14
13
  API, providing simple, idiomatic access to its endpoints.
@@ -29,10 +28,10 @@ files:
29
28
  - lib/milady_cima_api/client.rb
30
29
  - lib/milady_cima_api/errors.rb
31
30
  - lib/milady_cima_api/resources/courses.rb
31
+ - lib/milady_cima_api/resources/courses/assessments.rb
32
32
  - lib/milady_cima_api/resources/organizations.rb
33
33
  - lib/milady_cima_api/resources/users.rb
34
34
  - lib/milady_cima_api/version.rb
35
- - milady-cima-api.gemspec
36
35
  homepage: https://github.com/jippylong12/milady-cima-api
37
36
  licenses:
38
37
  - MIT
@@ -41,7 +40,6 @@ metadata:
41
40
  homepage_uri: https://github.com/jippylong12/milady-cima-api
42
41
  source_code_uri: https://github.com/jippylong12/milady-cima-api
43
42
  changelog_uri: https://github.com/jippylong12/milady-cima-api/blob/main/CHANGELOG.md
44
- post_install_message:
45
43
  rdoc_options: []
46
44
  require_paths:
47
45
  - lib
@@ -56,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
54
  - !ruby/object:Gem::Version
57
55
  version: '0'
58
56
  requirements: []
59
- rubygems_version: 3.5.22
60
- signing_key:
57
+ rubygems_version: 3.7.2
61
58
  specification_version: 4
62
59
  summary: Ruby wrapper for the MiLady CIMA API.
63
60
  test_files: []
@@ -1,40 +0,0 @@
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