stormpath-sdk 1.1.0 → 1.1.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
2
  SHA1:
3
- metadata.gz: 1d31ad099a140c12a0522f4bca201aebb81838e4
4
- data.tar.gz: b1de03018cc6bf723c873dd3c8368cdb197d3ac8
3
+ metadata.gz: c4f96be2ec3144f0626f0f61fa70ef9903e8a40f
4
+ data.tar.gz: ebacced6a9e5386548c86db7898d937a77d6486c
5
5
  SHA512:
6
- metadata.gz: a4829ff4c1ac11afff95f83ae2f7adda7ca796bd13369a45635496607da558b6c10e3ca6f8e0e4ec38e7930a3d62b796aad461e157de216381644f3705a60c44
7
- data.tar.gz: a437e1bf41aa13588ae014d9dcc9f3730537e31558b2e1b268ca92052098f747228d7f634714b6c9d766e04996cc89a202dade529d6fe9c11d254d0e483dcd56
6
+ metadata.gz: ae503d5ac8fca7b264dda2698f03e74d67e185b94fad45abf85cf71a018f598df3a6e0ed8f7cf5941033b503452cc10c71d4cb660be8aa58907026fd55e29c78
7
+ data.tar.gz: 713737f4fb364fb7313c8b142f69a78043e4d5e9b312f38256a865efaf2bd948016719f66346ff7d0d42130d545bca45edcf6bc2420333d745466885ed8ff397
data/CHANGES.md CHANGED
@@ -1,6 +1,14 @@
1
1
  stormpath-sdk-ruby Changelog
2
2
  ============================
3
3
 
4
+ Version 1.1.1
5
+ -------------
6
+
7
+ Released on May 19, 2016
8
+
9
+ - Add timestamps (created_at & modified_at) for account, application, custom_data,
10
+ directory, group, organization and tenant resource
11
+
4
12
  Version 1.1.0
5
13
  -------------
6
14
 
data/README.md CHANGED
@@ -901,6 +901,13 @@ $ rake gem
901
901
  $ gem install pkg/stormpath-sdk-{version}.gem
902
902
  ```
903
903
 
904
+ ### Releasing the Gem
905
+
906
+ 1. Update the gem version following semantic versioning
907
+ 2. Update the version date
908
+ 3. Update the CHANGES.md
909
+ 4. Run `rake release`
910
+
904
911
  ## Quick Class Diagram
905
912
 
906
913
  ```
@@ -19,7 +19,7 @@ class Stormpath::Resource::Account < Stormpath::Resource::Instance
19
19
 
20
20
  prop_accessor :username, :email, :given_name, :middle_name, :surname
21
21
  prop_writer :password
22
- prop_reader :full_name
22
+ prop_reader :full_name, :created_at, :modified_at, :password_modified_at
23
23
  prop_non_printable :password
24
24
 
25
25
  belongs_to :directory
@@ -22,6 +22,7 @@ class Stormpath::Resource::Application < Stormpath::Resource::Instance
22
22
  class LoadError < Stormpath::Error; end
23
23
 
24
24
  prop_accessor :name, :description, :authorized_callback_uris
25
+ prop_reader :created_at, :modified_at
25
26
 
26
27
  belongs_to :tenant
27
28
 
@@ -16,6 +16,8 @@
16
16
  class Stormpath::Resource::CustomData < Stormpath::Resource::Instance
17
17
  include Stormpath::Resource::CustomDataHashMethods
18
18
 
19
+ prop_reader :created_at, :modified_at
20
+
19
21
  def [](property_name)
20
22
  get_property property_name, ignore_camelcasing: true
21
23
  end
@@ -23,7 +25,7 @@ class Stormpath::Resource::CustomData < Stormpath::Resource::Instance
23
25
  def []=(property_name, property_value)
24
26
  set_property property_name, property_value, ignore_camelcasing: true
25
27
  end
26
-
28
+
27
29
  def save
28
30
  if has_removed_properties?
29
31
  delete_removed_properties
@@ -19,6 +19,7 @@ class Stormpath::Resource::Directory < Stormpath::Resource::Instance
19
19
  include Stormpath::Resource::AccountOverrides
20
20
 
21
21
  prop_accessor :name, :description
22
+ prop_reader :created_at, :modified_at
22
23
 
23
24
  belongs_to :tenant
24
25
 
@@ -56,4 +57,3 @@ class Stormpath::Resource::Directory < Stormpath::Resource::Instance
56
57
  data_store.create mappings.href, mappings, Stormpath::Provider::SamlMappingRules
57
58
  end
58
59
  end
59
-
@@ -18,6 +18,7 @@ class Stormpath::Resource::Group < Stormpath::Resource::Instance
18
18
  include Stormpath::Resource::CustomDataStorage
19
19
 
20
20
  prop_accessor :name, :description
21
+ prop_reader :created_at, :modified_at
21
22
 
22
23
  belongs_to :tenant
23
24
  belongs_to :directory
@@ -4,6 +4,8 @@ class Stormpath::Resource::Organization < Stormpath::Resource::Instance
4
4
  prop_accessor :name, :description, :name_key, :status, :account_store_mappings,
5
5
  :default_account_store_mapping, :default_group_store_mapping
6
6
 
7
+ prop_reader :created_at, :modified_at
8
+
7
9
  has_many :groups
8
10
  has_many :accounts
9
11
  belongs_to :tenant
@@ -16,7 +16,7 @@
16
16
  class Stormpath::Resource::Tenant < Stormpath::Resource::Instance
17
17
  include Stormpath::Resource::CustomDataStorage
18
18
 
19
- prop_reader :name, :key
19
+ prop_reader :name, :key, :created_at, :modified_at
20
20
 
21
21
  has_many :applications
22
22
  has_many :directories
@@ -14,6 +14,6 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Stormpath
17
- VERSION = '1.1.0'
18
- VERSION_DATE = '2016-05-11'
17
+ VERSION = '1.1.1'
18
+ VERSION_DATE = '2016-05-19'
19
19
  end
@@ -28,6 +28,11 @@ describe Stormpath::Resource::Account, :vcr do
28
28
  expect(account.send property_accessor).to be_a String
29
29
  end
30
30
 
31
+ [:created_at, :modified_at, :password_modified_at].each do |property_getter|
32
+ expect(account).to respond_to(property_getter)
33
+ expect(account.send property_getter).to be_a String
34
+ end
35
+
31
36
  expect(account).to respond_to(:full_name)
32
37
  expect(account.full_name).to be_a String
33
38
  expect(account.full_name).to eq("#{given_name} #{middle_name} #{surname}")
@@ -27,6 +27,11 @@ describe Stormpath::Resource::Application, :vcr do
27
27
  expect(application.send property_accessor).to be_a String
28
28
  end
29
29
 
30
+ [:created_at, :modified_at].each do |property_getter|
31
+ expect(application).to respond_to(property_getter)
32
+ expect(application.send property_getter).to be_a String
33
+ end
34
+
30
35
  expect(application.tenant).to be_a Stormpath::Resource::Tenant
31
36
  expect(application.default_account_store_mapping).to be_a Stormpath::Resource::AccountStoreMapping
32
37
  expect(application.default_group_store_mapping).to be_a Stormpath::Resource::AccountStoreMapping
@@ -106,7 +111,7 @@ describe Stormpath::Resource::Application, :vcr do
106
111
  application.authorized_callback_uris = authorized_callback_uris
107
112
  response = application.save
108
113
 
109
- expect(response).to eq application
114
+ expect(response).to eq application
110
115
  #expect(application.authorized_callback_uris).to eq(authorized_callback_uris)
111
116
  end
112
117
  end
@@ -36,6 +36,11 @@ describe Stormpath::Resource::Directory, :vcr do
36
36
  expect(directory.send property_accessor).to be_a String
37
37
  end
38
38
 
39
+ [:created_at, :modified_at].each do |property_getter|
40
+ expect(directory).to respond_to(property_getter)
41
+ expect(directory.send property_getter).to be_a String
42
+ end
43
+
39
44
  expect(directory.tenant).to be_a Stormpath::Resource::Tenant
40
45
  expect(directory.groups).to be_a Stormpath::Resource::Collection
41
46
  expect(directory.accounts).to be_a Stormpath::Resource::Collection
@@ -179,10 +184,10 @@ describe Stormpath::Resource::Directory, :vcr do
179
184
 
180
185
  it 'creates an account' do
181
186
  expect(@account).to be_a Stormpath::Resource::Account
182
- expect(@account.username).to eq("jlucpicard")
183
- expect(@account.email).to eq("captain@enterprise.com")
184
- expect(@account.given_name).to eq("Jean-Luc")
185
- expect(@account.surname).to eq("Picard")
187
+ expect(@account.username).to eq("jlucpicard")
188
+ expect(@account.email).to eq("captain@enterprise.com")
189
+ expect(@account.given_name).to eq("Jean-Luc")
190
+ expect(@account.surname).to eq("Picard")
186
191
  end
187
192
 
188
193
  it 'can authenticate with the account credentials' do
@@ -192,8 +197,8 @@ describe Stormpath::Resource::Directory, :vcr do
192
197
  expect(auth_result).to be_a Stormpath::Authentication::AuthenticationResult
193
198
  expect(auth_result.account).to be_a Stormpath::Resource::Account
194
199
  expect(auth_result.account.email).to eq("captain@enterprise.com")
195
- expect(auth_result.account.given_name).to eq("Jean-Luc")
196
- expect(auth_result.account.surname).to eq("Picard")
200
+ expect(auth_result.account.given_name).to eq("Jean-Luc")
201
+ expect(auth_result.account.surname).to eq("Picard")
197
202
  end
198
203
  end
199
204
 
@@ -211,10 +216,10 @@ describe Stormpath::Resource::Directory, :vcr do
211
216
 
212
217
  it 'creates an account' do
213
218
  expect(@account).to be_a Stormpath::Resource::Account
214
- expect(@account.username).to eq("jlucpicard")
215
- expect(@account.email).to eq("captain@enterprise.com")
216
- expect(@account.given_name).to eq("Jean-Luc")
217
- expect(@account.surname).to eq("Picard")
219
+ expect(@account.username).to eq("jlucpicard")
220
+ expect(@account.email).to eq("captain@enterprise.com")
221
+ expect(@account.given_name).to eq("Jean-Luc")
222
+ expect(@account.surname).to eq("Picard")
218
223
  end
219
224
 
220
225
  it 'can authenticate with the account credentials' do
@@ -224,8 +229,8 @@ describe Stormpath::Resource::Directory, :vcr do
224
229
  expect(auth_result).to be_a Stormpath::Authentication::AuthenticationResult
225
230
  expect(auth_result.account).to be_a Stormpath::Resource::Account
226
231
  expect(auth_result.account.email).to eq("captain@enterprise.com")
227
- expect(auth_result.account.given_name).to eq("Jean-Luc")
228
- expect(auth_result.account.surname).to eq("Picard")
232
+ expect(auth_result.account.given_name).to eq("Jean-Luc")
233
+ expect(auth_result.account.surname).to eq("Picard")
229
234
  end
230
235
  end
231
236
 
@@ -243,7 +248,7 @@ describe Stormpath::Resource::Directory, :vcr do
243
248
  after do
244
249
  created_account_with_hash.delete if created_account_with_hash
245
250
  end
246
-
251
+
247
252
  it 'creates an account with status ENABLED' do
248
253
  expect(created_account_with_hash.email).to eq(random_email)
249
254
  expect(created_account_with_hash.given_name).to eq('Ruby SDK')
@@ -319,7 +324,7 @@ describe Stormpath::Resource::Directory, :vcr do
319
324
  encoded_x509_signing_cert:"",
320
325
  request_signature_algorithm:"RSA-SHA256"
321
326
  }
322
- )
327
+ )
323
328
  end.to raise_error Stormpath::Error
324
329
  end
325
330
  end
@@ -353,11 +358,11 @@ describe Stormpath::Resource::Directory, :vcr do
353
358
 
354
359
  directory
355
360
  expect(directory.provider.href).not_to be_empty
356
- expect(directory.provider.provider_id).to eq("saml")
361
+ expect(directory.provider.provider_id).to eq("saml")
357
362
  expect(directory.provider.sso_login_url).to eq("https://yourIdp.com/saml2/sso/login")
358
- expect(directory.provider.sso_logout_url).to eq("https://yourIdp.com/saml2/sso/logout")
363
+ expect(directory.provider.sso_logout_url).to eq("https://yourIdp.com/saml2/sso/logout")
359
364
  expect(directory.provider.encoded_x509_signing_cert).not_to be_empty
360
- expect(directory.provider.request_signature_algorithm).to eq("RSA-SHA256")
365
+ expect(directory.provider.request_signature_algorithm).to eq("RSA-SHA256")
361
366
  end
362
367
  end
363
368
 
@@ -378,7 +383,7 @@ describe Stormpath::Resource::Directory, :vcr do
378
383
 
379
384
  after do
380
385
  directory.delete if directory
381
- end
386
+ end
382
387
 
383
388
  it 'returnes provider metadata' do
384
389
  stub_request(:post, "https://api.stormpath.com/v1/directories").
@@ -414,7 +419,7 @@ describe Stormpath::Resource::Directory, :vcr do
414
419
 
415
420
  after do
416
421
  directory.delete if directory
417
- end
422
+ end
418
423
 
419
424
  it 'updates the directory mappings' do
420
425
  mappings = Stormpath::Provider::SamlMappingRules.new(items: [
@@ -429,8 +434,8 @@ describe Stormpath::Resource::Directory, :vcr do
429
434
 
430
435
  stub_request(:get, directory.href + "/provider").
431
436
  to_return(status: 200, body: fixture('get_saml_directory_provider.json'), headers:{})
432
-
433
- stub_request(:post, directory.provider.attribute_statement_mapping_rules["href"]).
437
+
438
+ stub_request(:post, directory.provider.attribute_statement_mapping_rules["href"]).
434
439
  to_return(status:200, body: fixture('create_saml_directory_mapping_rules.json'), headers:{})
435
440
 
436
441
  response = directory.create_attribute_mappings(mappings)
@@ -18,6 +18,11 @@ describe Stormpath::Resource::Group, :vcr do
18
18
  expect(group.send property_accessor).to be_a String
19
19
  end
20
20
 
21
+ [:created_at, :modified_at].each do |property_getter|
22
+ expect(group).to respond_to(property_getter)
23
+ expect(group.send property_getter).to be_a String
24
+ end
25
+
21
26
  expect(group.tenant).to be_a Stormpath::Resource::Tenant
22
27
  expect(group.directory).to be_a Stormpath::Resource::Directory
23
28
  expect(group.custom_data).to be_a Stormpath::Resource::CustomData
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe Stormpath::Resource::Organization, :vcr do
4
4
 
5
- let(:organization) do
5
+ let(:organization) do
6
6
  test_api_client.organizations.create name: 'test_organization',
7
- name_key: "testorganization"
7
+ name_key: "testorganization", description: 'test organization'
8
8
  end
9
9
 
10
10
  after do
@@ -18,6 +18,26 @@ describe Stormpath::Resource::Organization, :vcr do
18
18
  })
19
19
  end
20
20
 
21
+ describe "instances should respond to attribute property methods" do
22
+ it do
23
+ [:name, :description, :name_key, :status].each do |property_accessor|
24
+ expect(organization).to respond_to(property_accessor)
25
+ expect(organization).to respond_to("#{property_accessor}=")
26
+ expect(organization.send property_accessor).to be_a String
27
+ end
28
+
29
+ [:created_at, :modified_at].each do |property_getter|
30
+ expect(organization).to respond_to(property_getter)
31
+ expect(organization.send property_getter).to be_a String
32
+ end
33
+
34
+ expect(organization.tenant).to be_a Stormpath::Resource::Tenant
35
+ expect(organization.custom_data).to be_a Stormpath::Resource::CustomData
36
+ expect(organization.groups).to be_a Stormpath::Resource::Collection
37
+ expect(organization.accounts).to be_a Stormpath::Resource::Collection
38
+ end
39
+ end
40
+
21
41
  describe 'get resource' do
22
42
  let(:fetched_organization) { test_api_client.organizations.get organization.href }
23
43
 
@@ -51,11 +71,11 @@ describe Stormpath::Resource::Organization, :vcr do
51
71
  describe 'associations' do
52
72
  context 'groups' do
53
73
 
54
- let(:directory) { test_api_client.directories.create name: random_directory_name }
55
-
56
- let(:group) { directory.groups.create name: "test_group" }
74
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
75
+
76
+ let(:group) { directory.groups.create name: "test_group" }
57
77
 
58
- before do
78
+ before do
59
79
  create_organization_account_store_mapping(organization, group)
60
80
  end
61
81
 
@@ -68,14 +88,14 @@ describe Stormpath::Resource::Organization, :vcr do
68
88
  expect(organization.groups).to be_kind_of(Stormpath::Resource::Collection)
69
89
  expect(organization.groups).to include(group)
70
90
  end
71
- end
91
+ end
72
92
 
73
93
  context 'accounts' do
74
- let(:directory) { test_api_client.directories.create name: random_directory_name }
94
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
75
95
 
76
96
  let(:account) { directory.accounts.create({ email: 'rubysdk@example.com', given_name: 'Ruby SDK', password: 'P@$$w0rd',surname: 'SDK' }) }
77
-
78
- before do
97
+
98
+ before do
79
99
  create_organization_account_store_mapping(organization, directory)
80
100
  end
81
101
 
@@ -91,9 +111,9 @@ describe Stormpath::Resource::Organization, :vcr do
91
111
  end
92
112
 
93
113
  context 'tenant' do
94
- let(:directory) { test_api_client.directories.create name: random_directory_name }
95
-
96
- before do
114
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
115
+
116
+ before do
97
117
  create_organization_account_store_mapping(organization, directory)
98
118
  end
99
119
 
@@ -136,12 +156,12 @@ describe Stormpath::Resource::Organization, :vcr do
136
156
 
137
157
  describe 'organization account store mapping' do
138
158
  context 'given an account_store is a directory' do
139
- let(:directory) { test_api_client.directories.create name: random_directory_name }
159
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
140
160
 
141
161
  let(:organization_account_store_mapping) do
142
162
  create_organization_account_store_mapping(organization, directory)
143
163
  end
144
-
164
+
145
165
  let(:reloaded_mapping) do
146
166
  test_api_client.account_store_mappings.get organization_account_store_mapping.href
147
167
  end
@@ -158,9 +178,9 @@ describe Stormpath::Resource::Organization, :vcr do
158
178
  end
159
179
 
160
180
  context 'given an account_store is a group' do
161
- let(:directory) { test_api_client.directories.create name: random_directory_name }
162
-
163
- let(:group) { directory.groups.create name: "test_group" }
181
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
182
+
183
+ let(:group) { directory.groups.create name: "test_group" }
164
184
 
165
185
  let(:organization_account_store_mapping) do
166
186
  create_organization_account_store_mapping(organization, group)
@@ -8,9 +8,9 @@ describe Stormpath::Resource::Tenant, :vcr do
8
8
  it do
9
9
  expect(tenant).to be_a Stormpath::Resource::Tenant
10
10
 
11
- [:name, :key].each do |property_accessor|
12
- expect(tenant).to respond_to(property_accessor)
13
- expect(tenant.send property_accessor).to be_a String
11
+ [:name, :key, :created_at, :modified_at].each do |property_getter|
12
+ expect(tenant).to respond_to(property_getter)
13
+ expect(tenant.send property_getter).to be_a String
14
14
  end
15
15
 
16
16
  expect(tenant.applications).to be_a Stormpath::Resource::Collection
@@ -31,4 +31,4 @@ describe Stormpath::Resource::Tenant, :vcr do
31
31
  end
32
32
  end
33
33
 
34
- end
34
+ end
@@ -71,6 +71,11 @@ shared_examples_for 'custom_data_storage' do
71
71
  expect(custom_data_storage.custom_data["modifiedAt"]).not_to eq(nil)
72
72
  end
73
73
 
74
+ it 'getters for timestamps work' do
75
+ expect(custom_data_storage.custom_data.created_at).not_to eq(nil)
76
+ expect(custom_data_storage.custom_data.modified_at).not_to eq(nil)
77
+ end
78
+
74
79
  RESERVED_FIELDS.each do |reserved_field|
75
80
  it "set reserved data #{reserved_field} should raise error" do
76
81
  custom_data_storage.custom_data[reserved_field] = 12
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormpath-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stormpath, Inc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-11 00:00:00.000000000 Z
12
+ date: 2016-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json