strongmind-platform-sdk 3.12.0 → 3.14.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: d9650669b798c4e681351ff97d79386a05cd33ec537ea46055d74db177d223f4
4
- data.tar.gz: 55b9a5b7d48b4b1c62d076eb9bf2fb955f31862ccc4f415e76199c8d3547c86d
3
+ metadata.gz: 6dcae177b414fd9883edab007eab75402a72d058da0dbcb3b5e76e9524451290
4
+ data.tar.gz: 76a4ff7eeebff3d3336e8e3cd0af19aaa2516b1c30582e69d94c231f1c296461
5
5
  SHA512:
6
- metadata.gz: 8c6eaafc7da26172b89f85701b313e8894ec5fcc4b033fef6e7b7ba888a2ca942543612689d6890ef19ce6c713def788f9416b15e9a09abe1e0ab7cfe7627282
7
- data.tar.gz: 76fa602eecc8d85405c8dfa39481dc1a710aad94cb4d3d37c1df74f02307210ac18dfb1b138377ad06a5a73e9ed8b79d3d218510c330c6b6ad1884fd031c1fed
6
+ metadata.gz: ce0e09ef5b8fe76d72ac5991427c6e8b996936721f4bb4adfe44d87a887cf47557a0d997199b465cc8408d20bfd0e190125190091c7e2b35af51874d88de3d3d
7
+ data.tar.gz: 999b50edcf189f7b46930760c29ccd9ec11481e593c6ba0e6a6f68c0ae4f850fb5b12111b3569b162e617f1d6a4a24f19ce774cc2fdc079bf0be84ce774daee1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.12.0)
4
+ strongmind-platform-sdk (3.14.0)
5
5
  aws-sdk-secretsmanager (~> 1.66)
6
6
  faraday (~> 2.5, >= 2.5.2)
7
7
  faraday-retry
@@ -26,17 +26,17 @@ GEM
26
26
  public_suffix (>= 2.0.2, < 6.0)
27
27
  ast (2.4.2)
28
28
  aws-eventstream (1.3.0)
29
- aws-partitions (1.918.0)
30
- aws-sdk-cloudwatch (1.89.0)
31
- aws-sdk-core (~> 3, >= 3.191.0)
29
+ aws-partitions (1.921.0)
30
+ aws-sdk-cloudwatch (1.90.0)
31
+ aws-sdk-core (~> 3, >= 3.193.0)
32
32
  aws-sigv4 (~> 1.1)
33
- aws-sdk-core (3.192.1)
33
+ aws-sdk-core (3.193.0)
34
34
  aws-eventstream (~> 1, >= 1.3.0)
35
35
  aws-partitions (~> 1, >= 1.651.0)
36
36
  aws-sigv4 (~> 1.8)
37
37
  jmespath (~> 1, >= 1.6.1)
38
- aws-sdk-secretsmanager (1.91.0)
39
- aws-sdk-core (~> 3, >= 3.191.0)
38
+ aws-sdk-secretsmanager (1.92.0)
39
+ aws-sdk-core (~> 3, >= 3.193.0)
40
40
  aws-sigv4 (~> 1.1)
41
41
  aws-sigv4 (1.8.0)
42
42
  aws-eventstream (~> 1, >= 1.0.2)
@@ -110,7 +110,7 @@ GEM
110
110
  ruby2_keywords (0.0.5)
111
111
  sentry-ruby (5.16.1)
112
112
  concurrent-ruby (~> 1.0, >= 1.0.2)
113
- sidekiq (7.2.2)
113
+ sidekiq (7.2.4)
114
114
  concurrent-ruby (< 2)
115
115
  connection_pool (>= 2.3.0)
116
116
  rack (>= 2.2.4)
@@ -118,7 +118,7 @@ GEM
118
118
  strongmind-oneroster-client (2.0.3)
119
119
  json (~> 2.1, >= 2.1.0)
120
120
  typhoeus (~> 1.0, >= 1.0.1)
121
- strongmind-sidekiq-cloudwatchmetrics (2.6.1)
121
+ strongmind-sidekiq-cloudwatchmetrics (2.6.3)
122
122
  aws-sdk-cloudwatch (~> 1.6)
123
123
  sidekiq (>= 5.0, < 8.0)
124
124
  sys-uname (1.2.3)
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformSdk
4
+ module Events
5
+ # Event Platform Client
6
+ class Client
7
+ def initialize(base_url, auth_client, conn: nil)
8
+ @auth_client = auth_client
9
+ @base_url = base_url
10
+ @conn = conn || build_connection
11
+ end
12
+
13
+ def send_event(event)
14
+ send_message(event)
15
+ end
16
+
17
+ private
18
+
19
+ def build_connection
20
+ Faraday.new(@base_url) do |faraday|
21
+ faraday.headers = headers
22
+ faraday.adapter Faraday.default_adapter
23
+ faraday.response :json, content_type: /\bjson$/, parser_options: { symbolize_names: true }
24
+ faraday.response :raise_error
25
+ end
26
+ end
27
+
28
+ def headers
29
+ {
30
+ 'Authorization': "Bearer #{@auth_client.auth_token}",
31
+ 'Content-Type': "application/cloudevents+json; charset=utf-8"
32
+ }
33
+ end
34
+
35
+ def send_message(message, path: 'events/v1/')
36
+ @conn.post(path, message.to_json)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "faraday/net_http"
5
+ require "json"
6
+
7
+ require "platform_sdk/events/client"
8
+
9
+ module PlatformSdk
10
+ module Events
11
+
12
+ end
13
+ end
@@ -31,6 +31,12 @@ module PlatformSdk
31
31
  @conn.post("/ws/schema/query/com.strongmind.#{query_name}?pagesize=#{page_size}", params).body["record"]
32
32
  end
33
33
 
34
+ def get(path, params = nil, expansions = nil)
35
+ params ||= {} if expansions
36
+ params[:expansions] = expansions.join(",") if expansions
37
+ @conn.get(path, params).body
38
+ end
39
+
34
40
  def special_programs
35
41
  records_as_json = power_query("specialprograms")
36
42
  records_as_json.map { |record| SpecialProgram.new(record) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "3.12.0"
4
+ VERSION = "3.14.0"
5
5
  end
data/lib/platform_sdk.rb CHANGED
@@ -14,6 +14,7 @@ require "platform_sdk/sentry"
14
14
  require "platform_sdk/learnosity_api"
15
15
  require "platform_sdk/canvas_api"
16
16
  require "platform_sdk/bynder"
17
+ require "platform_sdk/events"
17
18
 
18
19
  module PlatformSdk
19
20
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0
4
+ version: 3.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-23 00:00:00.000000000 Z
11
+ date: 2024-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -189,6 +189,8 @@ files:
189
189
  - lib/platform_sdk/edfi/client.rb
190
190
  - lib/platform_sdk/edkey.rb
191
191
  - lib/platform_sdk/edkey/client.rb
192
+ - lib/platform_sdk/events.rb
193
+ - lib/platform_sdk/events/client.rb
192
194
  - lib/platform_sdk/id_mapper.rb
193
195
  - lib/platform_sdk/id_mapper/client.rb
194
196
  - lib/platform_sdk/id_mapper/constants.rb