authlete 0.5.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/authlete.rb +24 -1
  3. data/lib/authlete/api.rb +298 -146
  4. data/lib/authlete/authentication-server.rb +1 -1
  5. data/lib/authlete/exception.rb +6 -3
  6. data/lib/authlete/model/client-extension.rb +135 -135
  7. data/lib/authlete/model/client-list.rb +128 -128
  8. data/lib/authlete/model/client.rb +468 -468
  9. data/lib/authlete/model/hashable.rb +1 -1
  10. data/lib/authlete/model/pair.rb +102 -102
  11. data/lib/authlete/model/property.rb +116 -0
  12. data/lib/authlete/model/request/authentication-callback-request.rb +90 -90
  13. data/lib/authlete/model/request/authorization-fail-request.rb +107 -104
  14. data/lib/authlete/model/request/authorization-issue-request.rb +167 -133
  15. data/lib/authlete/model/request/authorization-request.rb +101 -101
  16. data/lib/authlete/model/request/client-authorization-delete-request.rb +123 -0
  17. data/lib/authlete/model/request/client-authorization-get-list-request.rb +123 -0
  18. data/lib/authlete/model/request/client-authorization-update-request.rb +118 -0
  19. data/lib/authlete/model/request/client-secret-update-request.rb +121 -0
  20. data/lib/authlete/model/request/developer-authentication-callback-request.rb +84 -84
  21. data/lib/authlete/model/request/granted-scopes-request.rb +103 -0
  22. data/lib/authlete/model/request/introspection-request.rb +117 -39
  23. data/lib/authlete/model/request/revocation-request.rb +125 -0
  24. data/lib/authlete/model/request/standard-introspection-request.rb +102 -0
  25. data/lib/authlete/model/request/token-create-request.rb +250 -0
  26. data/lib/authlete/model/request/token-fail-request.rb +104 -101
  27. data/lib/authlete/model/request/token-issue-request.rb +116 -101
  28. data/lib/authlete/model/request/token-request.rb +127 -121
  29. data/lib/authlete/model/request/token-update-request.rb +165 -0
  30. data/lib/authlete/model/request/user-info-issue-request.rb +113 -0
  31. data/lib/authlete/model/request/user-info-request.rb +102 -0
  32. data/lib/authlete/model/response/authentication-callback-response.rb +53 -53
  33. data/lib/authlete/model/response/authorization-fail-response.rb +48 -48
  34. data/lib/authlete/model/response/authorization-issue-response.rb +85 -48
  35. data/lib/authlete/model/response/authorization-response.rb +177 -164
  36. data/lib/authlete/model/response/client-authorization-get-list-response.rb +60 -0
  37. data/lib/authlete/model/response/client-secret-refresh-response.rb +48 -0
  38. data/lib/authlete/model/response/client-secret-update-response.rb +48 -0
  39. data/lib/authlete/model/response/developer-authentication-callback-response.rb +55 -55
  40. data/lib/authlete/model/response/granted-scopes-get-response.rb +63 -0
  41. data/lib/authlete/model/response/introspection-response.rb +163 -132
  42. data/lib/authlete/model/response/revocation-response.rb +49 -0
  43. data/lib/authlete/model/response/service-creatable-response.rb +50 -50
  44. data/lib/authlete/model/response/standard-introspection-response.rb +49 -0
  45. data/lib/authlete/model/response/token-create-response.rb +100 -0
  46. data/lib/authlete/model/response/token-fail-response.rb +49 -49
  47. data/lib/authlete/model/response/token-issue-response.rb +138 -49
  48. data/lib/authlete/model/response/token-response.rb +168 -70
  49. data/lib/authlete/model/response/token-update-response.rb +62 -0
  50. data/lib/authlete/model/response/user-info-issue-response.rb +47 -0
  51. data/lib/authlete/model/response/user-info-response.rb +85 -0
  52. data/lib/authlete/model/result.rb +44 -44
  53. data/lib/authlete/model/scope.rb +1 -1
  54. data/lib/authlete/model/service-list.rb +1 -1
  55. data/lib/authlete/model/service-owner.rb +1 -1
  56. data/lib/authlete/model/service.rb +4 -2
  57. data/lib/authlete/model/sns-credentials.rb +1 -1
  58. data/lib/authlete/model/tagged-value.rb +97 -97
  59. data/lib/authlete/utility.rb +1 -1
  60. data/lib/authlete/version.rb +2 -2
  61. metadata +24 -2
@@ -1,102 +1,102 @@
1
- # :nodoc:
2
- #
3
- # Copyright (C) 2014-2015 Authlete, Inc.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
-
18
- require 'set'
19
-
20
-
21
- module Authlete
22
- module Model
23
- module Request
24
- # == Authlete::Model::Request::AuthorizationRequest class
25
- #
26
- # This class represents a request to Authlete's /api/auth/authorization API.
27
- class AuthorizationRequest < Authlete::Model::Hashable
28
- # The OAuth 2.0 authorization request parameters. (String)
29
- attr_accessor :parameters
30
-
31
- private
32
-
33
- # String attributes.
34
- STRING_ATTRIBUTES = ::Set.new([ :parameters ])
35
-
36
- # The constructor which takes a hash that represents a JSON request to
37
- # Authlete's /api/auth/authorization API.
38
- def initialize(hash = nil)
39
- # Set default values to string attributes.
40
- STRING_ATTRIBUTES.each do |attr|
41
- send("#{attr}=", nil)
42
- end
43
-
44
- # Set attribute values using the given hash.
45
- authlete_model_update(hash)
46
- end
47
-
48
- def authlete_model_convert_key(key)
49
- key.to_sym
50
- end
51
-
52
- def authlete_model_simple_attribute?(key)
53
- STRING_ATTRIBUTES.include?(key)
54
- end
55
-
56
- def authlete_model_update(hash)
57
- return if hash.nil?
58
-
59
- hash.each do |key, value|
60
- key = authlete_model_convert_key(key)
61
-
62
- if authlete_model_simple_attribute?(key)
63
- send("#{key}=", value)
64
- end
65
- end
66
-
67
- self
68
- end
69
-
70
- public
71
-
72
- # Construct an instance from the given hash.
73
- #
74
- # If the given argument is nil or is not a Hash, nil is returned.
75
- # Otherwise, AuthorizationRequest.new(hash) is returned.
76
- def self.parse(hash)
77
- if hash.nil? or (hash.kind_of?(Hash) == false)
78
- return nil
79
- end
80
-
81
- return AuthorizationRequest.new(hash)
82
- end
83
-
84
- # Convert this object into a hash.
85
- def to_hash
86
- hash = {}
87
-
88
- instance_variables.each do |var|
89
- key = var.to_s.delete("@").to_sym
90
- val = instance_variable_get(var)
91
-
92
- if authlete_model_simple_attribute?(key) or val.nil?
93
- hash[key] = val
94
- end
95
- end
96
-
97
- hash
98
- end
99
- end
100
- end
101
- end
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 2014-2018 Authlete, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ require 'set'
19
+
20
+
21
+ module Authlete
22
+ module Model
23
+ module Request
24
+ # == Authlete::Model::Request::AuthorizationRequest class
25
+ #
26
+ # This class represents a request to Authlete's /api/auth/authorization API.
27
+ class AuthorizationRequest < Authlete::Model::Hashable
28
+ # The OAuth 2.0 authorization request parameters. (String)
29
+ attr_accessor :parameters
30
+
31
+ private
32
+
33
+ # String attributes.
34
+ STRING_ATTRIBUTES = ::Set.new([ :parameters ])
35
+
36
+ # The constructor which takes a hash that represents a JSON request to
37
+ # Authlete's /api/auth/authorization API.
38
+ def initialize(hash = nil)
39
+ # Set default values to string attributes.
40
+ STRING_ATTRIBUTES.each do |attr|
41
+ send("#{attr}=", nil)
42
+ end
43
+
44
+ # Set attribute values using the given hash.
45
+ authlete_model_update(hash)
46
+ end
47
+
48
+ def authlete_model_convert_key(key)
49
+ key.to_sym
50
+ end
51
+
52
+ def authlete_model_simple_attribute?(key)
53
+ STRING_ATTRIBUTES.include?(key)
54
+ end
55
+
56
+ def authlete_model_update(hash)
57
+ return if hash.nil?
58
+
59
+ hash.each do |key, value|
60
+ key = authlete_model_convert_key(key)
61
+
62
+ if authlete_model_simple_attribute?(key)
63
+ send("#{key}=", value)
64
+ end
65
+ end
66
+
67
+ self
68
+ end
69
+
70
+ public
71
+
72
+ # Construct an instance from the given hash.
73
+ #
74
+ # If the given argument is nil or is not a Hash, nil is returned.
75
+ # Otherwise, AuthorizationRequest.new(hash) is returned.
76
+ def self.parse(hash)
77
+ if hash.nil? or (hash.kind_of?(Hash) == false)
78
+ return nil
79
+ end
80
+
81
+ return AuthorizationRequest.new(hash)
82
+ end
83
+
84
+ # Convert this object into a hash.
85
+ def to_hash
86
+ hash = {}
87
+
88
+ instance_variables.each do |var|
89
+ key = var.to_s.delete("@").to_sym
90
+ val = instance_variable_get(var)
91
+
92
+ if authlete_model_simple_attribute?(key) or val.nil?
93
+ hash[key] = val
94
+ end
95
+ end
96
+
97
+ hash
98
+ end
99
+ end
100
+ end
101
+ end
102
102
  end
@@ -0,0 +1,123 @@
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 2014-2018 Authlete, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ require 'set'
19
+
20
+
21
+ module Authlete
22
+ module Model
23
+ module Request
24
+ # == Authlete::Model::Request::ClientAuthorizationDeleteRequest class
25
+ #
26
+ # This class represents a request to Authlete's /api/client/authorization/delete API.
27
+ class ClientAuthorizationDeleteRequest < Authlete::Model::Hashable
28
+
29
+ # Unique user ID. (String)
30
+ attr_accessor :subject
31
+
32
+ # Start index of search results (inclusive).
33
+ # (Integer)
34
+ attr_accessor :start
35
+
36
+ # End index of search results (exclusive).
37
+ # (Integer)
38
+ attr_accessor :end
39
+
40
+ # Unique Developer ID. (String)
41
+ attr_accessor :developer
42
+
43
+ private
44
+
45
+ # Integer attributes.
46
+ INTEGER_ATTRIBUTES = ::Set.new([ :start, :end ])
47
+
48
+ # String attributes.
49
+ STRING_ATTRIBUTES = ::Set.new([ :subject, :developer ])
50
+
51
+ # The constructor which takes a hash that represents a JSON request
52
+ # to Authlete's /api/client/authorization/delete API.
53
+ def initialize(hash = nil)
54
+ # Set default values to integer attributes.
55
+ INTEGER_ATTRIBUTES.each do |attr|
56
+ send("#{attr}=", 0)
57
+ end
58
+
59
+ # Set default values to string attributes.
60
+ STRING_ATTRIBUTES.each do |attr|
61
+ send("#{attr}=", nil)
62
+ end
63
+
64
+ # Set attribute values using the given hash.
65
+ authlete_model_update(hash)
66
+ end
67
+
68
+ def authlete_model_convert_key(key)
69
+ key.to_sym
70
+ end
71
+
72
+ def authlete_model_simple_attribute?(key)
73
+ INTEGER_ATTRIBUTES.include?(key) or
74
+ STRING_ATTRIBUTES.include?(key)
75
+ end
76
+
77
+ def authlete_model_update(hash)
78
+ return if hash.nil?
79
+
80
+ hash.each do |key, value|
81
+ key = authlete_model_convert_key(key)
82
+
83
+ if authlete_model_simple_attribute?(key)
84
+ send("#{key}=", value)
85
+ end
86
+ end
87
+
88
+ self
89
+ end
90
+
91
+ public
92
+
93
+ # Construct an instance from the given hash.
94
+ #
95
+ # If the given argument is nil or is not a Hash, nil is returned.
96
+ # Otherwise, ClientAuthorizationDeleteRequest.new(hash) is returned.
97
+ def self.parse(hash)
98
+ if hash.nil? or (hash.kind_of?(Hash) == false)
99
+ return nil
100
+ end
101
+
102
+ return ClientAuthorizationDeleteRequest.new(hash)
103
+ end
104
+
105
+ # Convert this object into a hash.
106
+ def to_hash
107
+ hash = {}
108
+
109
+ instance_variables.each do |var|
110
+ key = var.to_s.delete("@").to_sym
111
+ val = instance_variable_get(var)
112
+
113
+ if authlete_model_simple_attribute?(key) or val.nil?
114
+ hash[key] = val
115
+ end
116
+ end
117
+
118
+ hash
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,123 @@
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 2014-2018 Authlete, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ require 'set'
19
+
20
+
21
+ module Authlete
22
+ module Model
23
+ module Request
24
+ # == Authlete::Model::Request::ClientAuthorizationGetListRequest class
25
+ #
26
+ # This class represents a request to Authlete's /api/client/authorization/get/list API.
27
+ class ClientAuthorizationGetListRequest < Authlete::Model::Hashable
28
+
29
+ # Unique user ID. (String)
30
+ attr_accessor :subject
31
+
32
+ # Start index of search results (inclusive).
33
+ # (Integer)
34
+ attr_accessor :start
35
+
36
+ # End index of search results (exclusive).
37
+ # (Integer)
38
+ attr_accessor :end
39
+
40
+ # Unique Developer ID. (String)
41
+ attr_accessor :developer
42
+
43
+ private
44
+
45
+ # Integer attributes.
46
+ INTEGER_ATTRIBUTES = ::Set.new([ :start, :end ])
47
+
48
+ # String attributes.
49
+ STRING_ATTRIBUTES = ::Set.new([ :subject, :developer ])
50
+
51
+ # The constructor which takes a hash that represents a JSON request
52
+ # to Authlete's /api/client/authorization/get/list API.
53
+ def initialize(hash = nil)
54
+ # Set default values to integer attributes.
55
+ INTEGER_ATTRIBUTES.each do |attr|
56
+ send("#{attr}=", 0)
57
+ end
58
+
59
+ # Set default values to string attributes.
60
+ STRING_ATTRIBUTES.each do |attr|
61
+ send("#{attr}=", nil)
62
+ end
63
+
64
+ # Set attribute values using the given hash.
65
+ authlete_model_update(hash)
66
+ end
67
+
68
+ def authlete_model_convert_key(key)
69
+ key.to_sym
70
+ end
71
+
72
+ def authlete_model_simple_attribute?(key)
73
+ INTEGER_ATTRIBUTES.include?(key) or
74
+ STRING_ATTRIBUTES.include?(key)
75
+ end
76
+
77
+ def authlete_model_update(hash)
78
+ return if hash.nil?
79
+
80
+ hash.each do |key, value|
81
+ key = authlete_model_convert_key(key)
82
+
83
+ if authlete_model_simple_attribute?(key)
84
+ send("#{key}=", value)
85
+ end
86
+ end
87
+
88
+ self
89
+ end
90
+
91
+ public
92
+
93
+ # Construct an instance from the given hash.
94
+ #
95
+ # If the given argument is nil or is not a Hash, nil is returned.
96
+ # Otherwise, ClientAuthorizationGetListRequest.new(hash) is returned.
97
+ def self.parse(hash)
98
+ if hash.nil? or (hash.kind_of?(Hash) == false)
99
+ return nil
100
+ end
101
+
102
+ return ClientAuthorizationGetListRequest.new(hash)
103
+ end
104
+
105
+ # Convert this object into a hash.
106
+ def to_hash
107
+ hash = {}
108
+
109
+ instance_variables.each do |var|
110
+ key = var.to_s.delete("@").to_sym
111
+ val = instance_variable_get(var)
112
+
113
+ if authlete_model_simple_attribute?(key) or val.nil?
114
+ hash[key] = val
115
+ end
116
+ end
117
+
118
+ hash
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end