strongmind-platform-sdk 3.19.0 → 3.19.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +79 -4
- data/lib/platform_sdk/identity/clients.rb +2 -0
- data/lib/platform_sdk/identity.rb +1 -0
- data/lib/platform_sdk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd597a3c3a31921754c613bf53ce663646111eb15958eb9e259f9f8110da7b87
|
4
|
+
data.tar.gz: 0ef2bc5c64de9fe8482bc80c5a919b7d7a8a1fe9d9af244052b46cfcdd1a4089
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f8b7902628784c4e38886f7e54b4e59f76bdc18d617439bb05585fbc3185a3675d4911a8dd989a0829e5e86e76876bbfd835ea5ffb278dfdce2a17dc3692409
|
7
|
+
data.tar.gz: a14a4e3f84780ef8af02fab7358ba258576f4fe13cc424130f6e3941cde6eed4fed30751a7b57190eb0bb6b2ec209479bc18d4907a3048d12b11cca5622d0571
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@ First [configure your GitHub credentials](#configure-github-credentials)
|
|
11
11
|
Install the gem and add to the application's Gemfile by executing:
|
12
12
|
|
13
13
|
```
|
14
|
-
gem "strongmind-platform-sdk", "~> 3.
|
14
|
+
gem "strongmind-platform-sdk", "~> 3.19.1"
|
15
15
|
```
|
16
16
|
|
17
17
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
@@ -67,9 +67,15 @@ gem push --key github --host https://rubygems.pkg.github.com/StrongMind platform
|
|
67
67
|
|
68
68
|
## Development
|
69
69
|
|
70
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
70
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
71
71
|
|
72
|
-
|
72
|
+
Migrate the database for the dummy app:
|
73
|
+
```
|
74
|
+
cd spec/dummy
|
75
|
+
rails db:migrate
|
76
|
+
```
|
77
|
+
|
78
|
+
Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
73
79
|
|
74
80
|
## Contributing
|
75
81
|
|
@@ -83,10 +89,78 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
83
89
|
|
84
90
|
Everyone interacting in the Platform::Ruby::Sdk project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/platform-ruby-sdk/blob/main/CODE_OF_CONDUCT.md).
|
85
91
|
|
86
|
-
##
|
92
|
+
## Data Pipeline Concern
|
93
|
+
|
94
|
+
The `DataPipelineable` concern is a shared concern that can be included in models
|
95
|
+
automatically to send data to the Data Pipeline on creates, updates, and destroys.
|
96
|
+
|
97
|
+
### Installation
|
98
|
+
Ensure that `platform-sdk` is required in the application.
|
99
|
+
|
100
|
+
One way to do this is to require the SDK via the `Gemfile`:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
gem 'strongmind-platform-sdk', require: 'platform_sdk'
|
104
|
+
```
|
105
|
+
|
106
|
+
This provides the application access to the `DataPipelineable` concern and RSpec shared examples.
|
107
|
+
|
108
|
+
### Usage
|
109
|
+
|
110
|
+
To use the `DataPipelineable` concern in a model, include the concern in the model:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
class MyModel < ApplicationRecord
|
114
|
+
include PlatformSdk::ActiveRecord::DataPipelineable
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
For the concern to function, the model must have a `pipeline_noun` class method that returns the noun of the model.
|
119
|
+
|
120
|
+
This can be done once by defining the method in the ApplicationRecord class:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
class ApplicationRecord < ActiveRecord::Base
|
124
|
+
self.abstract_class = true
|
125
|
+
|
126
|
+
def self.pipeline_noun
|
127
|
+
"StrongMind.Central.#{name}}"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
```
|
131
|
+
|
132
|
+
Or it can be defined in each model:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
class MyModel < ApplicationRecord
|
136
|
+
include PlatformSdk::ActiveRecord::DataPipelineable
|
137
|
+
|
138
|
+
def self.pipeline_noun
|
139
|
+
"StrongMind.Central.#{name}}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
```
|
143
|
+
|
144
|
+
### Testing
|
145
|
+
|
146
|
+
To test the `DataPipelineable` concern for a model, include the common shared examples in the model's spec file:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
RSpec.describe MyModel, type: :model do
|
150
|
+
describe 'sends to the Data Pipeline' do
|
151
|
+
it_behaves_like 'DataPipelineable'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
```
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
## Setting up IRB for API Client Testing
|
87
159
|
Require needed dependencies:
|
88
160
|
`require 'platform_sdk'`
|
89
161
|
|
162
|
+
|
163
|
+
### OneRoster API Client Initialization Example
|
90
164
|
Open IRB and initialize dependencies:
|
91
165
|
* IDENTITY_CLIENT_ID
|
92
166
|
* IDENTITY_CLIENT_SECRET
|
@@ -102,6 +176,7 @@ Create Identity Auth Client:
|
|
102
176
|
Create OneRoster Client:
|
103
177
|
`one_roster_client = PlatformSdk::OneRoster::Client.new(ONEROSTER_BASE_URL, auth_client)`
|
104
178
|
|
179
|
+
### Additional Client Initialization Examples
|
105
180
|
Create Aws Client:
|
106
181
|
`aws_client = PlatformSdk::Aws::SecretsManagerClient.new(access_key_id: 'ACCESS_KEY_ID', secret_access_key: 'SECRET_ACCESS_KEY', region: 'REGION')`
|
107
182
|
|
data/lib/platform_sdk/version.rb
CHANGED