liblynx-api 1.0.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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "doc": {
3
+ "url_style": "default",
4
+ "disable_title_and_description": false,
5
+ "toc": true
6
+ }
7
+ }
@@ -0,0 +1,13 @@
1
+ require 'heroics'
2
+ require File.join(File.expand_path('../..', __FILE__), 'lib', 'liblynx-api', 'version.rb')
3
+
4
+ Heroics.default_configuration do |config|
5
+ config.base_url = 'https://connect.liblynx.com'
6
+ config.module_name = 'LibLynxAPI'
7
+ config.schema_filepath = File.join(File.expand_path('../..', __FILE__), 'schema.json')
8
+ config.headers = {
9
+ 'Accept' => 'application/json',
10
+ 'User-Agent' => "liblynx-api/#{LibLynxAPI::VERSION}"
11
+ }
12
+ config.cache_path = '#{Dir.home}/.heroics/liblynx-api'
13
+ end
@@ -0,0 +1,22 @@
1
+ require 'heroics'
2
+ require_relative '../config/config'
3
+
4
+ require 'liblynx-api/client'
5
+ require 'liblynx-api/version'
6
+
7
+ module LibLynxAPI
8
+ # Get a Client configured to use OAuth2 client credentials authentication.
9
+ #
10
+ # @param id [String] The client id to use with the API.
11
+ # @param secret [String] The client secret to use with the API.
12
+ # @return [Client] A client configured to use the API with OAuth2
13
+ # authentication.
14
+ def self.connect_oauth2(id, secret)
15
+ client = connect(secret, user: id)
16
+ token = client
17
+ .token
18
+ .create(grant_type: :client_credentials)
19
+ .dig('access_token')
20
+ connect_oauth(token)
21
+ end
22
+ end
@@ -0,0 +1,1153 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # WARNING: Do not edit by hand, this file was generated by Heroics:
6
+ #
7
+ # https://github.com/interagent/heroics
8
+ #
9
+
10
+ require 'heroics'
11
+ require 'uri'
12
+ require 'moneta'
13
+
14
+ module LibLynxAPI
15
+ # Get a Client configured to use HTTP Basic or header-based authentication.
16
+ #
17
+ # @param api_key [String] The API key to use when connecting.
18
+ # @param options [Hash<Symbol,String>] Optionally, custom settings
19
+ # to use with the client. Allowed options are `default_headers`,
20
+ # `cache`, `user` and `url`.
21
+ # @return [Client] A client configured to use the API with HTTP Basic
22
+ # or header-based authentication.
23
+ def self.connect(api_key, options=nil)
24
+ options = custom_options(options)
25
+ uri = URI.parse(options[:url])
26
+
27
+ if options[:user]
28
+ uri.user = URI.encode_www_form_component options[:user]
29
+ end
30
+
31
+ if api_key
32
+ uri.user ||= 'user'
33
+ uri.password = api_key
34
+ end
35
+
36
+ client = Heroics.client_from_schema(SCHEMA, uri.to_s, options)
37
+ Client.new(client)
38
+ end
39
+
40
+ # Get a Client configured to use OAuth authentication.
41
+ #
42
+ # @param oauth_token [String] The OAuth token to use with the API.
43
+ # @param options [Hash<Symbol,String>] Optionally, custom settings
44
+ # to use with the client. Allowed options are `default_headers`,
45
+ # `cache` and `url`.
46
+ # @return [Client] A client configured to use the API with OAuth
47
+ # authentication.
48
+ def self.connect_oauth(oauth_token, options=nil)
49
+ options = custom_options(options)
50
+ url = options[:url]
51
+ client = Heroics.oauth_client_from_schema(oauth_token, SCHEMA, url, options)
52
+ Client.new(client)
53
+ end
54
+
55
+ # Get a Client configured to use Token authentication.
56
+ #
57
+ # @param token [String] The token to use with the API.
58
+ # @param options [Hash<Symbol,String>] Optionally, custom settings
59
+ # to use with the client. Allowed options are `default_headers`,
60
+ # `cache` and `url`.
61
+ # @return [Client] A client configured to use the API with OAuth
62
+ # authentication.
63
+ def self.connect_token(token, options=nil)
64
+ options = custom_options(options)
65
+ url = options[:url]
66
+ client = Heroics.token_client_from_schema(token, SCHEMA, url, options)
67
+ Client.new(client)
68
+ end
69
+
70
+ # Get customized options.
71
+ def self.custom_options(options)
72
+ return default_options if options.nil?
73
+
74
+ final_options = default_options
75
+ if options[:default_headers]
76
+ final_options[:default_headers].merge!(options[:default_headers])
77
+ end
78
+ final_options[:cache] = options[:cache] || Moneta.new(:File, dir: "#{Dir.home}/.heroics/liblynx-api")
79
+ final_options[:url] = options[:url] if options[:url]
80
+ final_options[:user] = options[:user] if options[:user]
81
+ final_options
82
+ end
83
+
84
+ # Get the default options.
85
+ def self.default_options
86
+ default_headers = {"Accept"=>"application/json", "User-Agent"=>"liblynx-api/1.0.0"}
87
+ {
88
+ default_headers: default_headers,
89
+ url: "https://connect.liblynx.com"
90
+ }
91
+ end
92
+
93
+ private_class_method :default_options, :custom_options
94
+
95
+ # LibLynx API schema
96
+ class Client
97
+ def initialize(client)
98
+ @client = client
99
+ end
100
+
101
+ #
102
+ #
103
+ # @return [Account]
104
+ def account
105
+ @account_resource ||= Account.new(@client)
106
+ end
107
+
108
+ #
109
+ #
110
+ # @return [Identification]
111
+ def identification
112
+ @identification_resource ||= Identification.new(@client)
113
+ end
114
+
115
+ #
116
+ #
117
+ # @return [Samlidp]
118
+ def samlidp
119
+ @samlidp_resource ||= Samlidp.new(@client)
120
+ end
121
+
122
+ #
123
+ #
124
+ # @return [Token]
125
+ def token
126
+ @token_resource ||= Token.new(@client)
127
+ end
128
+ end
129
+
130
+ private
131
+
132
+ #
133
+ class Account
134
+ def initialize(client)
135
+ @client = client
136
+ end
137
+
138
+ # Create a new account.
139
+ #
140
+ # @param body: the object to pass as the request payload
141
+ def create(body = {})
142
+ @client.account.create(body)
143
+ end
144
+
145
+ # Delete an existing account.
146
+ #
147
+ # @param account_identity:
148
+ def delete(account_identity)
149
+ @client.account.delete(account_identity)
150
+ end
151
+
152
+ # Info for existing account.
153
+ #
154
+ # @param account_identity:
155
+ def info(account_identity)
156
+ @client.account.info(account_identity)
157
+ end
158
+
159
+ # List existing accounts.
160
+ def list()
161
+ @client.account.list()
162
+ end
163
+
164
+ # Update an existing account.
165
+ #
166
+ # @param account_identity:
167
+ # @param body: the object to pass as the request payload
168
+ def update(account_identity, body = {})
169
+ @client.account.update(account_identity, body)
170
+ end
171
+ end
172
+
173
+ #
174
+ class Identification
175
+ def initialize(client)
176
+ @client = client
177
+ end
178
+
179
+ # create a new identification resource to try and identify an account to link a new session with
180
+ #
181
+ # @param body: the object to pass as the request payload
182
+ def create(body = {})
183
+ @client.identification.create(body)
184
+ end
185
+
186
+ # retrieve a single identification object
187
+ #
188
+ # @param identification_identity:
189
+ def info(identification_identity)
190
+ @client.identification.info(identification_identity)
191
+ end
192
+ end
193
+
194
+ #
195
+ class Samlidp
196
+ def initialize(client)
197
+ @client = client
198
+ end
199
+
200
+ # Create a new samlidp.
201
+ #
202
+ # @param account_identity:
203
+ # @param body: the object to pass as the request payload
204
+ def create(account_identity, body = {})
205
+ @client.samlidp.create(account_identity, body)
206
+ end
207
+
208
+ # Delete an existing samlidp.
209
+ #
210
+ # @param account_identity:
211
+ # @param samlidp_identity:
212
+ def delete(account_identity, samlidp_identity)
213
+ @client.samlidp.delete(account_identity, samlidp_identity)
214
+ end
215
+
216
+ # Info for existing samlidp.
217
+ #
218
+ # @param account_identity:
219
+ # @param samlidp_identity:
220
+ def info(account_identity, samlidp_identity)
221
+ @client.samlidp.info(account_identity, samlidp_identity)
222
+ end
223
+
224
+ # List existing samlidps.
225
+ #
226
+ # @param account_identity:
227
+ def list(account_identity)
228
+ @client.samlidp.list(account_identity)
229
+ end
230
+ end
231
+
232
+ #
233
+ class Token
234
+ def initialize(client)
235
+ @client = client
236
+ end
237
+
238
+ # Create a new oauth2 token
239
+ #
240
+ # @param body: the object to pass as the request payload
241
+ def create(body = {})
242
+ @client.token.create(body)
243
+ end
244
+ end
245
+
246
+ SCHEMA = Heroics::Schema.new(MultiJson.load(<<-'HEROICS_SCHEMA'))
247
+ {
248
+ "$schema": "http://interagent.github.io/interagent-hyper-schema",
249
+ "type": [
250
+ "object"
251
+ ],
252
+ "definitions": {
253
+ "account": {
254
+ "$schema": "http://json-schema.org/draft-04/hyper-schema",
255
+ "title": "Account",
256
+ "description": "",
257
+ "stability": "production",
258
+ "strictProperties": true,
259
+ "type": [
260
+ "object"
261
+ ],
262
+ "definitions": {
263
+ "id": {
264
+ "description": "unique identifier of account",
265
+ "readOnly": true,
266
+ "type": [
267
+ "integer"
268
+ ]
269
+ },
270
+ "account_name": {
271
+ "description": "unique name of account",
272
+ "type": [
273
+ "string"
274
+ ]
275
+ },
276
+ "email_domains": {
277
+ "description": "cr separated email domains",
278
+ "example": "*.somedomain.com\nalt.somedomain2.com",
279
+ "type": [
280
+ "string"
281
+ ]
282
+ },
283
+ "enable_saml": {
284
+ "description": "enable saml",
285
+ "type": [
286
+ "boolean"
287
+ ]
288
+ },
289
+ "enable_shibboleth": {
290
+ "description": "enable shibboleth",
291
+ "type": [
292
+ "boolean"
293
+ ]
294
+ },
295
+ "enable_ip": {
296
+ "description": "enable ip",
297
+ "type": [
298
+ "boolean"
299
+ ]
300
+ },
301
+ "enable_referrer": {
302
+ "description": "enable referrer",
303
+ "type": [
304
+ "boolean"
305
+ ]
306
+ },
307
+ "enable_library_card": {
308
+ "description": "enable library card",
309
+ "type": [
310
+ "boolean"
311
+ ]
312
+ },
313
+ "enable_individual": {
314
+ "description": "enable individual",
315
+ "type": [
316
+ "boolean"
317
+ ]
318
+ },
319
+ "enable_open_athens": {
320
+ "description": "enable open athens",
321
+ "type": [
322
+ "boolean"
323
+ ]
324
+ },
325
+ "enable_archimed": {
326
+ "description": "enable archimed",
327
+ "type": [
328
+ "boolean"
329
+ ]
330
+ },
331
+ "active": {
332
+ "description": "active",
333
+ "type": [
334
+ "boolean"
335
+ ]
336
+ },
337
+ "enable_pass_code": {
338
+ "description": "enable pass code",
339
+ "type": [
340
+ "boolean"
341
+ ]
342
+ },
343
+ "enable_self_registration": {
344
+ "description": "enable self registration",
345
+ "type": [
346
+ "boolean"
347
+ ]
348
+ },
349
+ "enable_lib_portal_stats": {
350
+ "description": "enable lib portal stats",
351
+ "type": [
352
+ "boolean"
353
+ ]
354
+ },
355
+ "individual_limit": {
356
+ "description": "individual limit",
357
+ "type": [
358
+ "integer"
359
+ ]
360
+ },
361
+ "individual": {
362
+ "description": "individual",
363
+ "type": [
364
+ "boolean"
365
+ ]
366
+ },
367
+ "type": {
368
+ "description": "type",
369
+ "type": [
370
+ "string"
371
+ ]
372
+ },
373
+ "identity": {
374
+ "$ref": "#/definitions/account/definitions/id"
375
+ },
376
+ "creation_date": {
377
+ "description": "when account was created",
378
+ "readOnly": true,
379
+ "format": "date-time",
380
+ "type": [
381
+ "string"
382
+ ]
383
+ },
384
+ "modified_date": {
385
+ "description": "when account was updated",
386
+ "readOnly": true,
387
+ "format": "date-time",
388
+ "type": [
389
+ "string"
390
+ ]
391
+ },
392
+ "publisher_reference": {
393
+ "description": "publisher reference",
394
+ "type": [
395
+ "string"
396
+ ]
397
+ },
398
+ "shibboleth_entity_id": {
399
+ "description": "shibboleth entity id",
400
+ "format": "uri",
401
+ "type": [
402
+ "string"
403
+ ]
404
+ }
405
+ },
406
+ "links": [
407
+ {
408
+ "description": "Create a new account.",
409
+ "href": "/api/accounts",
410
+ "method": "POST",
411
+ "rel": "create",
412
+ "schema": {
413
+ "properties": {
414
+ "account_name": {
415
+ "$ref": "#/definitions/account/definitions/account_name"
416
+ },
417
+ "publisher_reference": {
418
+ "$ref": "#/definitions/account/definitions/publisher_reference"
419
+ },
420
+ "email_domains": {
421
+ "$ref": "#/definitions/account/definitions/email_domains"
422
+ },
423
+ "enable_saml": {
424
+ "$ref": "#/definitions/account/definitions/enable_saml"
425
+ },
426
+ "enable_shibboleth": {
427
+ "$ref": "#/definitions/account/definitions/enable_shibboleth"
428
+ },
429
+ "shibboleth_entity_id": {
430
+ "$ref": "#/definitions/account/definitions/shibboleth_entity_id"
431
+ },
432
+ "enable_ip": {
433
+ "$ref": "#/definitions/account/definitions/enable_ip"
434
+ },
435
+ "enable_pass_code": {
436
+ "$ref": "#/definitions/account/definitions/enable_pass_code"
437
+ },
438
+ "enable_referrer": {
439
+ "$ref": "#/definitions/account/definitions/enable_referrer"
440
+ },
441
+ "enable_library_card": {
442
+ "$ref": "#/definitions/account/definitions/enable_library_card"
443
+ },
444
+ "enable_individual": {
445
+ "$ref": "#/definitions/account/definitions/enable_individual"
446
+ },
447
+ "enable_open_athens": {
448
+ "$ref": "#/definitions/account/definitions/enable_open_athens"
449
+ },
450
+ "enable_archimed": {
451
+ "$ref": "#/definitions/account/definitions/enable_archimed"
452
+ },
453
+ "active": {
454
+ "$ref": "#/definitions/account/definitions/active"
455
+ },
456
+ "enable_self_registration": {
457
+ "$ref": "#/definitions/account/definitions/enable_self_registration"
458
+ },
459
+ "enable_lib_portal_stats": {
460
+ "$ref": "#/definitions/account/definitions/enable_lib_portal_stats"
461
+ },
462
+ "individual_limit": {
463
+ "$ref": "#/definitions/account/definitions/individual_limit"
464
+ },
465
+ "individual": {
466
+ "$ref": "#/definitions/account/definitions/individual"
467
+ },
468
+ "type": {
469
+ "$ref": "#/definitions/account/definitions/type"
470
+ }
471
+ },
472
+ "required": [
473
+ "account_name"
474
+ ],
475
+ "type": [
476
+ "object"
477
+ ]
478
+ },
479
+ "title": "Create"
480
+ },
481
+ {
482
+ "description": "Delete an existing account.",
483
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}",
484
+ "method": "DELETE",
485
+ "rel": "destroy",
486
+ "title": "Delete",
487
+ "targetSchema": {
488
+ }
489
+ },
490
+ {
491
+ "description": "Info for existing account.",
492
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}",
493
+ "method": "GET",
494
+ "rel": "self",
495
+ "title": "Info"
496
+ },
497
+ {
498
+ "description": "List existing accounts.",
499
+ "href": "/api/accounts",
500
+ "method": "GET",
501
+ "rel": "instances",
502
+ "targetSchema": {
503
+ "properties": {
504
+ "accounts": {
505
+ "items": {
506
+ "properties": {
507
+ "id": {
508
+ "$ref": "#/definitions/account/definitions/id"
509
+ },
510
+ "account_name": {
511
+ "$ref": "#/definitions/account/definitions/account_name"
512
+ },
513
+ "individual": {
514
+ "$ref": "#/definitions/account/definitions/individual"
515
+ },
516
+ "active": {
517
+ "$ref": "#/definitions/account/definitions/active"
518
+ },
519
+ "publisher_reference": {
520
+ "$ref": "#/definitions/account/definitions/publisher_reference"
521
+ },
522
+ "type": {
523
+ "$ref": "#/definitions/account/definitions/type"
524
+ },
525
+ "modified_date": {
526
+ "$ref": "#/definitions/account/definitions/modified_date"
527
+ },
528
+ "creation_date": {
529
+ "$ref": "#/definitions/account/definitions/creation_date"
530
+ }
531
+ }
532
+ },
533
+ "type": [
534
+ "array"
535
+ ]
536
+ }
537
+ }
538
+ },
539
+ "title": "List"
540
+ },
541
+ {
542
+ "description": "Update an existing account.",
543
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}",
544
+ "method": "PUT",
545
+ "rel": "update",
546
+ "schema": {
547
+ "properties": {
548
+ "account_name": {
549
+ "$ref": "#/definitions/account/definitions/account_name"
550
+ },
551
+ "publisher_reference": {
552
+ "$ref": "#/definitions/account/definitions/publisher_reference"
553
+ },
554
+ "email_domains": {
555
+ "$ref": "#/definitions/account/definitions/email_domains"
556
+ },
557
+ "enable_saml": {
558
+ "$ref": "#/definitions/account/definitions/enable_saml"
559
+ },
560
+ "enable_shibboleth": {
561
+ "$ref": "#/definitions/account/definitions/enable_shibboleth"
562
+ },
563
+ "shibboleth_entity_id": {
564
+ "$ref": "#/definitions/account/definitions/shibboleth_entity_id"
565
+ },
566
+ "enable_ip": {
567
+ "$ref": "#/definitions/account/definitions/enable_ip"
568
+ },
569
+ "enable_pass_code": {
570
+ "$ref": "#/definitions/account/definitions/enable_pass_code"
571
+ },
572
+ "enable_referrer": {
573
+ "$ref": "#/definitions/account/definitions/enable_referrer"
574
+ },
575
+ "enable_library_card": {
576
+ "$ref": "#/definitions/account/definitions/enable_library_card"
577
+ },
578
+ "enable_individual": {
579
+ "$ref": "#/definitions/account/definitions/enable_individual"
580
+ },
581
+ "enable_open_athens": {
582
+ "$ref": "#/definitions/account/definitions/enable_open_athens"
583
+ },
584
+ "enable_archimed": {
585
+ "$ref": "#/definitions/account/definitions/enable_archimed"
586
+ },
587
+ "active": {
588
+ "$ref": "#/definitions/account/definitions/active"
589
+ },
590
+ "enable_self_registration": {
591
+ "$ref": "#/definitions/account/definitions/enable_self_registration"
592
+ },
593
+ "enable_lib_portal_stats": {
594
+ "$ref": "#/definitions/account/definitions/enable_lib_portal_stats"
595
+ },
596
+ "individual_limit": {
597
+ "$ref": "#/definitions/account/definitions/individual_limit"
598
+ },
599
+ "individual": {
600
+ "$ref": "#/definitions/account/definitions/individual"
601
+ },
602
+ "type": {
603
+ "$ref": "#/definitions/account/definitions/type"
604
+ }
605
+ },
606
+ "type": [
607
+ "object"
608
+ ]
609
+ },
610
+ "title": "Update"
611
+ }
612
+ ],
613
+ "properties": {
614
+ "created_at": {
615
+ "$ref": "#/definitions/account/definitions/creation_date"
616
+ },
617
+ "id": {
618
+ "$ref": "#/definitions/account/definitions/id"
619
+ },
620
+ "name": {
621
+ "$ref": "#/definitions/account/definitions/account_name"
622
+ },
623
+ "publisher_reference": {
624
+ "$ref": "#/definitions/account/definitions/publisher_reference"
625
+ },
626
+ "enable_saml": {
627
+ "$ref": "#/definitions/account/definitions/enable_saml"
628
+ },
629
+ "enable_shibboleth": {
630
+ "$ref": "#/definitions/account/definitions/enable_shibboleth"
631
+ },
632
+ "email_domains": {
633
+ "$ref": "#/definitions/account/definitions/email_domains"
634
+ },
635
+ "updated_at": {
636
+ "$ref": "#/definitions/account/definitions/modified_date"
637
+ },
638
+ "shibboleth_entity_id": {
639
+ "$ref": "#/definitions/account/definitions/shibboleth_entity_id"
640
+ },
641
+ "enable_ip": {
642
+ "$ref": "#/definitions/account/definitions/enable_ip"
643
+ },
644
+ "enable_pass_code": {
645
+ "$ref": "#/definitions/account/definitions/enable_pass_code"
646
+ },
647
+ "enable_referrer": {
648
+ "$ref": "#/definitions/account/definitions/enable_referrer"
649
+ },
650
+ "enable_library_card": {
651
+ "$ref": "#/definitions/account/definitions/enable_library_card"
652
+ },
653
+ "enable_individual": {
654
+ "$ref": "#/definitions/account/definitions/enable_individual"
655
+ },
656
+ "enable_open_athens": {
657
+ "$ref": "#/definitions/account/definitions/enable_open_athens"
658
+ },
659
+ "enable_archimed": {
660
+ "$ref": "#/definitions/account/definitions/enable_archimed"
661
+ },
662
+ "active": {
663
+ "$ref": "#/definitions/account/definitions/active"
664
+ },
665
+ "enable_self_registration": {
666
+ "$ref": "#/definitions/account/definitions/enable_self_registration"
667
+ },
668
+ "enable_lib_portal_stats": {
669
+ "$ref": "#/definitions/account/definitions/enable_lib_portal_stats"
670
+ },
671
+ "individual_limit": {
672
+ "$ref": "#/definitions/account/definitions/individual_limit"
673
+ },
674
+ "individual": {
675
+ "$ref": "#/definitions/account/definitions/individual"
676
+ },
677
+ "type": {
678
+ "$ref": "#/definitions/account/definitions/type"
679
+ }
680
+ }
681
+ },
682
+ "identification": {
683
+ "$schema": "http://json-schema.org/draft-04/hyper-schema",
684
+ "title": "Identification",
685
+ "description": "",
686
+ "stability": "production",
687
+ "strictProperties": true,
688
+ "type": [
689
+ "object"
690
+ ],
691
+ "definitions": {
692
+ "id": {
693
+ "description": "unique identifier of identification",
694
+ "readOnly": true,
695
+ "format": "uuid",
696
+ "type": [
697
+ "string"
698
+ ]
699
+ },
700
+ "identity": {
701
+ "$ref": "#/definitions/identification/definitions/id"
702
+ },
703
+ "created": {
704
+ "description": "when identification was created",
705
+ "format": "date-time",
706
+ "type": [
707
+ "string"
708
+ ]
709
+ },
710
+ "email": {
711
+ "description": "user email address",
712
+ "format": "email",
713
+ "type": [
714
+ "string"
715
+ ]
716
+ },
717
+ "url": {
718
+ "description": "callback url",
719
+ "format": "uri",
720
+ "type": [
721
+ "string"
722
+ ]
723
+ },
724
+ "ip": {
725
+ "description": "ip address",
726
+ "format": "ipv4",
727
+ "type": [
728
+ "string"
729
+ ]
730
+ },
731
+ "user_agent": {
732
+ "description": "user agent",
733
+ "type": [
734
+ "string"
735
+ ]
736
+ },
737
+ "status": {
738
+ "description": "status",
739
+ "type": [
740
+ "string"
741
+ ]
742
+ },
743
+ "terms": {
744
+ "description": "terms",
745
+ "type": [
746
+ "string"
747
+ ]
748
+ },
749
+ "authorizations": {
750
+ "description": "authorizations",
751
+ "type": [
752
+ "array"
753
+ ]
754
+ },
755
+ "unit_requests": {
756
+ "description": "unit requests",
757
+ "type": [
758
+ "array"
759
+ ]
760
+ },
761
+ "publisher": {
762
+ "description": "publisher",
763
+ "properties": {
764
+ "id": {
765
+ "type": [
766
+ "integer"
767
+ ]
768
+ },
769
+ "publisher_name": {
770
+ "type": [
771
+ "string"
772
+ ]
773
+ }
774
+ },
775
+ "type": [
776
+ "object"
777
+ ]
778
+ },
779
+ "user_institution": {
780
+ "description": "user institution",
781
+ "properties": {
782
+ "id": {
783
+ "type": [
784
+ "integer"
785
+ ]
786
+ },
787
+ "account_name": {
788
+ "type": [
789
+ "string"
790
+ ]
791
+ },
792
+ "country_code": {
793
+ "type": [
794
+ "string"
795
+ ]
796
+ },
797
+ "type": {
798
+ "type": [
799
+ "string"
800
+ ]
801
+ }
802
+ },
803
+ "type": [
804
+ "object"
805
+ ]
806
+ },
807
+ "target_account": {
808
+ "description": "target account",
809
+ "properties": {
810
+ "id": {
811
+ "type": [
812
+ "integer"
813
+ ]
814
+ },
815
+ "account_name": {
816
+ "type": [
817
+ "string"
818
+ ]
819
+ },
820
+ "individual": {
821
+ "type": [
822
+ "boolean"
823
+ ]
824
+ },
825
+ "type": {
826
+ "type": [
827
+ "string"
828
+ ]
829
+ },
830
+ "publisher_reference": {
831
+ "type": [
832
+ "string"
833
+ ]
834
+ }
835
+ },
836
+ "type": [
837
+ "object"
838
+ ]
839
+ }
840
+ },
841
+ "links": [
842
+ {
843
+ "description": "create a new identification resource to try and identify an account to link a new session with",
844
+ "href": "/api/identifications",
845
+ "method": "POST",
846
+ "rel": "create",
847
+ "schema": {
848
+ "properties": {
849
+ "email": {
850
+ "$ref": "#/definitions/identification/definitions/email"
851
+ },
852
+ "ip": {
853
+ "$ref": "#/definitions/identification/definitions/ip"
854
+ },
855
+ "user_agent": {
856
+ "$ref": "#/definitions/identification/definitions/user_agent"
857
+ },
858
+ "url": {
859
+ "$ref": "#/definitions/identification/definitions/url"
860
+ }
861
+ },
862
+ "required": [
863
+ "ip",
864
+ "user_agent",
865
+ "url"
866
+ ],
867
+ "type": [
868
+ "object"
869
+ ]
870
+ },
871
+ "title": "Create"
872
+ },
873
+ {
874
+ "description": "retrieve a single identification object",
875
+ "href": "/api/identifications/{(%23%2Fdefinitions%2Fidentification%2Fdefinitions%2Fidentity)}",
876
+ "method": "GET",
877
+ "rel": "self",
878
+ "title": "Info"
879
+ }
880
+ ],
881
+ "properties": {
882
+ "created": {
883
+ "$ref": "#/definitions/identification/definitions/created"
884
+ },
885
+ "id": {
886
+ "$ref": "#/definitions/identification/definitions/id"
887
+ },
888
+ "url": {
889
+ "$ref": "#/definitions/identification/definitions/url"
890
+ },
891
+ "ip": {
892
+ "$ref": "#/definitions/identification/definitions/ip"
893
+ },
894
+ "status": {
895
+ "$ref": "#/definitions/identification/definitions/status"
896
+ },
897
+ "terms": {
898
+ "$ref": "#/definitions/identification/definitions/terms"
899
+ },
900
+ "authorizations": {
901
+ "$ref": "#/definitions/identification/definitions/authorizations"
902
+ },
903
+ "unit_requests": {
904
+ "$ref": "#/definitions/identification/definitions/unit_requests"
905
+ },
906
+ "publisher": {
907
+ "$ref": "#/definitions/identification/definitions/publisher"
908
+ },
909
+ "user_agent": {
910
+ "$ref": "#/definitions/identification/definitions/user_agent"
911
+ },
912
+ "user_institution": {
913
+ "$ref": "#/definitions/identification/definitions/user_institution"
914
+ },
915
+ "target_account": {
916
+ "$ref": "#/definitions/identification/definitions/target_account"
917
+ }
918
+ }
919
+ },
920
+ "samlidp": {
921
+ "$schema": "http://json-schema.org/draft-04/hyper-schema",
922
+ "title": "Samlidp",
923
+ "description": "",
924
+ "stability": "production",
925
+ "strictProperties": true,
926
+ "type": [
927
+ "object"
928
+ ],
929
+ "definitions": {
930
+ "id": {
931
+ "description": "unique identifier of samlidp",
932
+ "readOnly": true,
933
+ "type": [
934
+ "integer"
935
+ ]
936
+ },
937
+ "descriptor_url": {
938
+ "description": "saml descriptor url",
939
+ "readOnly": true,
940
+ "type": [
941
+ "string"
942
+ ]
943
+ },
944
+ "xml_descriptor": {
945
+ "description": "xml descriptor",
946
+ "readOnly": true,
947
+ "type": [
948
+ "string"
949
+ ]
950
+ },
951
+ "type": {
952
+ "description": "type",
953
+ "readOnly": true,
954
+ "type": [
955
+ "string"
956
+ ]
957
+ },
958
+ "entity_id": {
959
+ "description": "entity_id",
960
+ "readOnly": true,
961
+ "type": [
962
+ "string"
963
+ ]
964
+ },
965
+ "identity": {
966
+ "$ref": "#/definitions/samlidp/definitions/id"
967
+ }
968
+ },
969
+ "links": [
970
+ {
971
+ "description": "Create a new samlidp.",
972
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}/samlidps",
973
+ "method": "POST",
974
+ "rel": "create",
975
+ "schema": {
976
+ "properties": {
977
+ "descriptor_url": {
978
+ "$ref": "#/definitions/samlidp/definitions/descriptor_url"
979
+ }
980
+ },
981
+ "required": [
982
+ "descriptor_url"
983
+ ],
984
+ "type": [
985
+ "object"
986
+ ]
987
+ },
988
+ "title": "Create"
989
+ },
990
+ {
991
+ "description": "Delete an existing samlidp.",
992
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}/samlidps/{(%23%2Fdefinitions%2Fsamlidp%2Fdefinitions%2Fidentity)}",
993
+ "method": "DELETE",
994
+ "rel": "destroy",
995
+ "title": "Delete",
996
+ "targetSchema": {
997
+ }
998
+ },
999
+ {
1000
+ "description": "Info for existing samlidp.",
1001
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}/samlidps/{(%23%2Fdefinitions%2Fsamlidp%2Fdefinitions%2Fidentity)}",
1002
+ "method": "GET",
1003
+ "rel": "self",
1004
+ "title": "Info"
1005
+ },
1006
+ {
1007
+ "description": "List existing samlidps.",
1008
+ "href": "/api/accounts/{(%23%2Fdefinitions%2Faccount%2Fdefinitions%2Fidentity)}/samlidps",
1009
+ "method": "GET",
1010
+ "rel": "instances",
1011
+ "title": "List",
1012
+ "targetSchema": {
1013
+ "properties": {
1014
+ "samlidps": {
1015
+ "items": {
1016
+ "properties": {
1017
+ "id": {
1018
+ "$ref": "#/definitions/samlidp/definitions/id"
1019
+ },
1020
+ "descriptor_url": {
1021
+ "$ref": "#/definitions/samlidp/definitions/descriptor_url"
1022
+ },
1023
+ "xml_descriptor": {
1024
+ "$ref": "#/definitions/samlidp/definitions/xml_descriptor"
1025
+ },
1026
+ "type": {
1027
+ "$ref": "#/definitions/samlidp/definitions/type"
1028
+ },
1029
+ "entity_id": {
1030
+ "$ref": "#/definitions/samlidp/definitions/entity_id"
1031
+ }
1032
+ }
1033
+ },
1034
+ "type": [
1035
+ "array"
1036
+ ]
1037
+ }
1038
+ }
1039
+ }
1040
+ }
1041
+ ],
1042
+ "properties": {
1043
+ "id": {
1044
+ "$ref": "#/definitions/samlidp/definitions/id"
1045
+ },
1046
+ "descriptor_url": {
1047
+ "$ref": "#/definitions/samlidp/definitions/descriptor_url"
1048
+ },
1049
+ "xml_descriptor": {
1050
+ "$ref": "#/definitions/samlidp/definitions/xml_descriptor"
1051
+ },
1052
+ "type": {
1053
+ "$ref": "#/definitions/samlidp/definitions/type"
1054
+ },
1055
+ "entity_id": {
1056
+ "$ref": "#/definitions/samlidp/definitions/entity_id"
1057
+ }
1058
+ }
1059
+ },
1060
+ "token": {
1061
+ "$schema": "http://json-schema.org/draft-04/hyper-schema",
1062
+ "title": "OAuth2 token",
1063
+ "description": "",
1064
+ "stability": "production",
1065
+ "strictProperties": true,
1066
+ "type": [
1067
+ "object"
1068
+ ],
1069
+ "definitions": {
1070
+ "account_token": {
1071
+ "description": "unique identifier of identification",
1072
+ "readOnly": true,
1073
+ "type": [
1074
+ "string"
1075
+ ]
1076
+ },
1077
+ "identity": {
1078
+ "$ref": "#/definitions/token/definitions/account_token"
1079
+ },
1080
+ "grant_type": {
1081
+ "description": "grant_type",
1082
+ "example": "client_credentials",
1083
+ "type": [
1084
+ "string"
1085
+ ]
1086
+ }
1087
+ },
1088
+ "links": [
1089
+ {
1090
+ "description": "Create a new oauth2 token",
1091
+ "encType": "application/x-www-form-urlencoded",
1092
+ "href": "/oauth/v2/token",
1093
+ "method": "POST",
1094
+ "rel": "create",
1095
+ "schema": {
1096
+ "properties": {
1097
+ "grant_type": {
1098
+ "$ref": "#/definitions/token/definitions/grant_type"
1099
+ }
1100
+ },
1101
+ "required": [
1102
+ "grant_type"
1103
+ ],
1104
+ "type": [
1105
+ "object"
1106
+ ]
1107
+ },
1108
+ "targetSchema": {
1109
+ "properties": {
1110
+ "account_token": {
1111
+ "$ref": "#/definitions/token/definitions/account_token"
1112
+ }
1113
+ },
1114
+ "type": [
1115
+ "object"
1116
+ ]
1117
+ },
1118
+ "title": "Create"
1119
+ }
1120
+ ],
1121
+ "properties": {
1122
+ "account_token": {
1123
+ "$ref": "#/definitions/token/definitions/account_token"
1124
+ }
1125
+ }
1126
+ }
1127
+ },
1128
+ "properties": {
1129
+ "account": {
1130
+ "$ref": "#/definitions/account"
1131
+ },
1132
+ "identification": {
1133
+ "$ref": "#/definitions/identification"
1134
+ },
1135
+ "samlidp": {
1136
+ "$ref": "#/definitions/samlidp"
1137
+ },
1138
+ "token": {
1139
+ "$ref": "#/definitions/token"
1140
+ }
1141
+ },
1142
+ "description": "LibLynx API schema",
1143
+ "id": "http://connect.liblynx.com/schema#",
1144
+ "links": [
1145
+ {
1146
+ "href": "https://connect.liblynx.com",
1147
+ "rel": "self"
1148
+ }
1149
+ ],
1150
+ "title": "LibLynx API"
1151
+ }
1152
+ HEROICS_SCHEMA
1153
+ end