authlete 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTI0YTA3NTliYjQ5YWI3Mzg2OGYxMTY5NDAzMjgyN2U4NDYyY2VkMA==
4
+ MDkwYjI3NWM2ZjgwMmIzN2FmMTM1OTQ2YTVkZTQ1N2FlYzRhZDY5Nw==
5
5
  data.tar.gz: !binary |-
6
- NmMwYTFlOTI1MTIyYzhhMzIyMTcwZmRiZmYzM2ZmMjk0ZGQ5OGE3ZA==
6
+ Mjc4NmNjNzUwMWQyMjI1MjQ3NDUxYWFlZTVhY2VhMzQyNTI1NDE1Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDQ2NTU2ODBlZTM1YWI5MjQzYjk2NWNhZjA3Y2Y4ZDdhN2I3M2E1ZjA0Y2Uw
10
- NzkzNWRlZjZhYjdkNjgyY2UxMzMyNjk3YmEyMjRkNjMzM2U1MDA5ZjE3ZWJm
11
- YzUwMjc0NTBjMjI3OTBhYzMwODZiNGYxNDdhNGFiOGY4YmI0ZmQ=
9
+ MzcxZTg0NDI4YTkxOWQwYWIxMmFjYWU3YjhmYWE0YTJiNWRmODQyYWEyOGQ1
10
+ OWViYTczNzIyNDY2YTA0NTZiODVhY2QxMjczOTU3ZDg1N2RkODBmMDEwNDBk
11
+ YWI2MjFhNTM5NzFhNWI1MjdhOWU4MWE1MGU1NDNiMmRmMmJkNGI=
12
12
  data.tar.gz: !binary |-
13
- MTQ5NDIxZWEwNWM3NjBmMzIwOThmNjU0MWNiMDBlOGI0YWIxMDc5ZDM2ZjQ5
14
- YTQ1ZDc5MmI0YzY5ZmVkZWMzYmE3OTJmZDk5NTI5OWJmZjg5ODMyNGEyZTQ4
15
- MzkxZmY4NzExZWJiZDI1YTk4MDlmYTAzYjYwYjY3M2ZlNWY0MGE=
13
+ ZWFkNzY2NmE2ZDIxZGUzZWIyMjU2OTJiM2JmOTkzZDY1YzY0NDYyMGUzMzkz
14
+ NDQ5YjU5ZWQ3NDk2ZDBjNjMxNmY4MWJjMzkyZjU5ODNjYmI2ZDI0YzA2NTJh
15
+ YmYxNDdiNjk2NjU4ZjAyNDY3Y2FiOThhYzg2NWMxNjg2N2FjZWQ=
@@ -30,6 +30,8 @@ module Authlete
30
30
  # The flag to indicate whether this scope is included in the
31
31
  # default scope set. (boolean)
32
32
  attr_accessor :defaultEntry
33
+ alias_method :default_entry, :defaultEntry
34
+ alias_method :default_entry=, :defaultEntry=
33
35
 
34
36
  private
35
37
 
@@ -39,6 +41,9 @@ module Authlete
39
41
  # String attributes.
40
42
  STRING_ATTRIBUTES = ::Set.new([:description, :name])
41
43
 
44
+ # Mapping from snake cases to camel cases.
45
+ SNAKE_TO_CAMEL = {:default_entry => :defaultEntry}
46
+
42
47
  # The constructor
43
48
  def initialize(hash = new)
44
49
  # Set default values to boolean attributes.
@@ -55,6 +60,17 @@ module Authlete
55
60
  authlete_model_scope_update(hash)
56
61
  end
57
62
 
63
+ def authlete_model_scope_to_key(key)
64
+ key = key.to_sym
65
+
66
+ # Convert snakecase to camelcase, if necessary.
67
+ if SNAKE_TO_CAMEL.has_key?(key)
68
+ key = SNAKE_TO_CAMEL[key]
69
+ end
70
+
71
+ return key
72
+ end
73
+
58
74
  def authlete_model_scope_simple_attribute?(key)
59
75
  BOOLEAN_ATTRIBUTES.include?(key) or
60
76
  STRING_ATTRIBUTES.include?(key)
@@ -66,7 +82,7 @@ module Authlete
66
82
  end
67
83
 
68
84
  hash.each do |key, value|
69
- key = key.to_sym
85
+ key = authlete_model_scope_to_key(key)
70
86
 
71
87
  # If the attribute is a simple one.
72
88
  if authlete_model_scope_simple_attribute?(key)
@@ -110,6 +126,27 @@ module Authlete
110
126
 
111
127
  return hash
112
128
  end
129
+
130
+ def [](key)
131
+ key = authlete_model_scope_to_key(key)
132
+
133
+ if respond_to?(key)
134
+ return send(key)
135
+ else
136
+ return nil
137
+ end
138
+ end
139
+
140
+ def []=(key, value)
141
+ key = authlete_model_scope_to_key(key)
142
+ method = "#{key}="
143
+
144
+ if respond_to?(method)
145
+ return send(method, value)
146
+ else
147
+ return nil
148
+ end
149
+ end
113
150
  end
114
151
  end
115
152
  end
@@ -23,33 +23,51 @@ module Authlete
23
23
  class Service
24
24
  # The duration of access tokens in seconds. (Integer)
25
25
  attr_accessor :accessTokenDuration
26
+ alias_method :access_token_duration, :accessTokenDuration
27
+ alias_method :access_token_duration=, :accessTokenDuration=
26
28
 
27
29
  # The access token type. (String)
28
30
  attr_accessor :accessTokenType
31
+ alias_method :access_token_type, :accessTokenType
32
+ alias_method :access_token_type=, :accessTokenType=
29
33
 
30
34
  # The API key. (Long)
31
35
  attr_accessor :apiKey
36
+ alias_method :api_key, :apiKey
37
+ alias_method :api_key=, :apiKey=
32
38
 
33
39
  # The API secret. (String)
34
40
  attr_accessor :apiSecret
41
+ alias_method :api_secret, :apiSecret
42
+ alias_method :api_secret=, :apiSecret=
35
43
 
36
44
  # The API key to access the authentication callback endpoint. (String)
37
45
  attr_accessor :authenticationCallbackApiKey
46
+ alias_method :authentication_callback_api_key, :authenticationCallbackApiKey
47
+ alias_method :authentication_callback_api_key=, :authenticationCallbackApiKey=
38
48
 
39
49
  # The API secret to access the authentication callback endpoint. (String)
40
50
  attr_accessor :authenticationCallbackApiSecret
51
+ alias_method :authentication_callback_api_secret, :authenticationCallbackApiSecret
52
+ alias_method :authentication_callback_api_secret=, :authenticationCallbackApiSecret=
41
53
 
42
54
  # The URI of the authentication callback endpoint. (URI)
43
55
  attr_accessor :authenticationCallbackEndpoint
56
+ alias_method :authentication_callback_endpoint, :authenticationCallbackEndpoint
57
+ alias_method :authentication_callback_endpoint=, :authenticationCallbackEndpoint=
44
58
 
45
59
  # The URI of the authorization endpoint. (URI)
46
60
  attr_accessor :authorizationEndpoint
61
+ alias_method :authorization_endpoint, :authorizationEndpoint
62
+ alias_method :authorization_endpoint=, :authorizationEndpoint=
47
63
 
48
64
  # The description of this service. (String)
49
65
  attr_accessor :description
50
66
 
51
67
  # The duration of ID tokens in seconds. (Integer)
52
68
  attr_accessor :idTokenDuration
69
+ alias_method :id_token_duration, :idTokenDuration
70
+ alias_method :id_token_duration=, :idTokenDuration=
53
71
 
54
72
  # The issuer identifier of this OpenID Provider. (URI)
55
73
  attr_accessor :issuer
@@ -59,55 +77,83 @@ module Authlete
59
77
 
60
78
  # The URI of the service's JSON Web Key Set. (URI)
61
79
  attr_accessor :jwksUri
80
+ alias_method :jwks_uri, :jwksUri
81
+ alias_method :jwks_uri=, :jwksUri=
62
82
 
63
83
  # The service number. (Integer)
64
84
  attr_accessor :number
65
85
 
66
86
  # The URI of the service's policy page. (URI)
67
87
  attr_accessor :policyUri
88
+ alias_method :policy_uri, :policyUri
89
+ alias_method :policy_uri=, :policyUri=
68
90
 
69
91
  # The duration of refresh tokens in seconds. (Integer)
70
92
  attr_accessor :refreshTokenDuration
93
+ alias_method :refresh_token_duration, :refreshTokenDuration
94
+ alias_method :refresh_token_duration=, :refreshTokenDuration=
71
95
 
72
96
  # The URI of the registration endpoint. (URI)
73
97
  attr_accessor :registrationEndpoint
98
+ alias_method :registration_endpoint, :registrationEndpoint
99
+ alias_method :registration_endpoint=, :registrationEndpoint=
74
100
 
75
101
  # The URI of the service's documentation. (URI)
76
102
  attr_accessor :serviceDocumentation
103
+ alias_method :service_documentation, :serviceDocumentation
104
+ alias_method :service_documentation=, :serviceDocumentation=
77
105
 
78
106
  # The service name. (String)
79
107
  attr_accessor :serviceName
108
+ alias_method :service_name, :serviceName
109
+ alias_method :service_name=, :serviceName=
80
110
 
81
111
  # The service owner number. (Integer)
82
112
  attr_accessor :serviceOwnerNumber
113
+ alias_method :service_owner_number, :serviceOwnerNumber
114
+ alias_method :service_owner_number=, :serviceOwnerNumber=
83
115
 
84
116
  # The list of SNS credentials. (SnsCredentials array)
85
117
  attr_accessor :snsCredentials
118
+ alias_method :sns_credentials, :snsCredentials
119
+ alias_method :sns_credentials=, :snsCredentials=
86
120
 
87
121
  # The list of supported ACRs. (String array)
88
122
  attr_accessor :supportedAcrs
123
+ alias_method :supported_acrs, :supportedAcrs
124
+ alias_method :supported_acrs=, :supportedAcrs=
89
125
 
90
126
  # The list of supported claim locales. (String array)
91
127
  attr_accessor :supportedClaimLocales
128
+ alias_method :supported_claim_locales, :supportedClaimLocales
129
+ alias_method :supported_claim_locales=, :supportedClaimLocales=
92
130
 
93
131
  # The list of supported claims. (String array)
94
132
  attr_accessor :supportedClaims
133
+ alias_method :supported_claims, :supportedClaims
134
+ alias_method :supported_claims=, :supportedClaims=
95
135
 
96
136
  # The list of supported claim types. (String array)
97
137
  #
98
138
  # Valid values are "NORMAL", "AGGREGATED" and "DISTRIBUTED".
99
139
  attr_accessor :supportedClaimTypes
140
+ alias_method :supported_claim_types, :supportedClaimTypes
141
+ alias_method :supported_claim_types=, :supportedClaimTypes=
100
142
 
101
143
  # The list of supported values of +display+ parameter. (String array)
102
144
  #
103
145
  # Valid values are "PAGE", "POPUP", "TOUCH" and "WAP".
104
146
  attr_accessor :supportedDisplays
147
+ alias_method :supported_displays, :supportedDisplays
148
+ alias_method :supported_displays=, :supportedDisplays=
105
149
 
106
150
  # The list of supported grant types. (String array)
107
151
  #
108
152
  # Valid values are "AUTHORIZATION_CODE", "IMPLICIT", "PASSWORD",
109
153
  # "CLIENT_CREDENTIALS" and "REFRESH_TOKEN".
110
154
  attr_accessor :supportedGrantTypes
155
+ alias_method :supported_grant_types, :supportedGrantTypes
156
+ alias_method :supported_grant_types=, :supportedGrantTypes=
111
157
 
112
158
  # The list of supported response types. (String array)
113
159
  #
@@ -115,30 +161,46 @@ module Authlete
115
161
  # "CODE_TOKEN", "CODE_ID_TOKEN", "ID_TOKEN_TOKEN" and
116
162
  # "CODE_ID_TOKEN_TOKEN".
117
163
  attr_accessor :supportedResponseTypes
164
+ alias_method :supported_response_types, :supportedResponseTypes
165
+ alias_method :supported_response_types=, :supportedResponseTypes=
118
166
 
119
167
  # The list of supported scopes. (Scope array)
120
168
  attr_accessor :supportedScopes
169
+ alias_method :supported_scopes, :supportedScopes
170
+ alias_method :supported_scopes=, :supportedScopes=
121
171
 
122
172
  # The list of supported SNSes. (Sns array)
123
173
  attr_accessor :supportedSnses
174
+ alias_method :supported_snses, :supportedSnses
175
+ alias_method :supported_snses=, :supportedSnses=
124
176
 
125
177
  # The list of supported client authentication methods at the token endpoint. (String array)
126
178
  #
127
179
  # Valid values are "NONE", "CLIENT_SECRET_BASIC", "CLIENT_SECRET_POST",
128
180
  # "CLIENT_SECRET_JWT" and "PRIVATE_KEY_JWT".
129
181
  attr_accessor :supportedTokenAuthMethods
182
+ alias_method :supported_token_auth_methods, :supportedTokenAuthMethods
183
+ alias_method :supported_token_auth_methods=, :supportedTokenAuthMethods=
130
184
 
131
185
  # The list of supported UI locales. (String array)
132
186
  attr_accessor :supportedUiLocales
187
+ alias_method :supported_ui_locales, :supportedUiLocales
188
+ alias_method :supported_ui_locales=, :supportedUiLocales=
133
189
 
134
190
  # The URI of the token endpoint. (URI)
135
191
  attr_accessor :tokenEndpoint
192
+ alias_method :token_endpoint, :tokenEndpoint
193
+ alias_method :token_endpoint=, :tokenEndpoint=
136
194
 
137
195
  # The URI of the service's "Terms Of Service" page. (URI)
138
196
  attr_accessor :tosUri
197
+ alias_method :tos_uri, :tosUri
198
+ alias_method :tos_uri=, :tosUri=
139
199
 
140
200
  # The URI of UserInfo endpoint. (URI)
141
201
  attr_accessor :userInfoEndpoint
202
+ alias_method :user_info_endpoint, :userInfoEndpoint
203
+ alias_method :user_info_endpoint=, :userInfoEndpoint=
142
204
 
143
205
  private
144
206
 
@@ -165,6 +227,41 @@ module Authlete
165
227
  :supportedUiLocales
166
228
  ])
167
229
 
230
+ # Mapping from snake cases to camel cases.
231
+ SNAKE_TO_CAMEL = {
232
+ :access_token_duration => :accessTokenDuration,
233
+ :access_token_type => :accessTokenType,
234
+ :api_key => :apiKey,
235
+ :api_secret => :apiSecret,
236
+ :authentication_callback_api_key => :authenticationCallbackApiKey,
237
+ :authentication_callback_api_secret => :authenticationCallbackApiSecret,
238
+ :authentication_callback_endpoint => :authenticationCallbackEndpoint,
239
+ :authorization_endpoint => :authorizationEndpoint,
240
+ :id_tokn_duration => :idTokenDuration,
241
+ :jwks_uri => :jwksUri,
242
+ :policy_uri => :policyUri,
243
+ :refresh_token_duration => :refreshTokenDuration,
244
+ :registration_endpoint => :registrationEndpoint,
245
+ :service_documentation => :serviceDocumentation,
246
+ :service_name => :serviceName,
247
+ :service_owner_number => :serviceOwnerNumber,
248
+ :sns_credentials => :snsCredentials,
249
+ :supported_acrs => :supportedAcrs,
250
+ :supported_claim_locales => :supportedClaimLocales,
251
+ :supported_claims => :supportedClaims,
252
+ :supported_claim_types => :supportedClaimTypes,
253
+ :supported_displays => :supportedDisplays,
254
+ :supported_grant_types => :supportedGrantTypes,
255
+ :supported_response_types => :supportedResponseTypes,
256
+ :supported_scopes => :supportedScopes,
257
+ :supported_snses => :supportedSnses,
258
+ :supported_token_auth_methods => :supportedTokenAuthMethods,
259
+ :supported_ui_locales => :supportedUiLocales,
260
+ :token_endpoint => :tokenEndpoint,
261
+ :tos_uri => :tosUri,
262
+ :user_info_endpoint => :userInfoEndpoint
263
+ }
264
+
168
265
  # The constructor
169
266
  def initialize(hash = nil)
170
267
  # Set default values to integer attributes.
@@ -190,6 +287,17 @@ module Authlete
190
287
  authlete_model_service_update(hash)
191
288
  end
192
289
 
290
+ def authlete_model_service_to_key(key)
291
+ key = key.to_sym
292
+
293
+ # Convert snakecase to camelcase, if necessary.
294
+ if SNAKE_TO_CAMEL.has_key?(key)
295
+ key = SNAKE_TO_CAMEL[key]
296
+ end
297
+
298
+ return key
299
+ end
300
+
193
301
  def authlete_model_service_simple_attribute?(key)
194
302
  INTEGER_ATTRIBUTES.include?(key) or
195
303
  STRING_ATTRIBUTES.include?(key) or
@@ -202,7 +310,7 @@ module Authlete
202
310
  end
203
311
 
204
312
  hash.each do |key, value|
205
- key = key.to_sym
313
+ key = authlete_model_service_to_key(key)
206
314
 
207
315
  # If the attribute is a simple one.
208
316
  if authlete_model_service_simple_attribute?(key)
@@ -284,6 +392,27 @@ module Authlete
284
392
 
285
393
  return hash
286
394
  end
395
+
396
+ def [](key)
397
+ key = authlete_model_service_to_key(key)
398
+
399
+ if respond_to?(key)
400
+ return send(key)
401
+ else
402
+ return nil
403
+ end
404
+ end
405
+
406
+ def []=(key, value)
407
+ key = authlete_model_service_to_key(key)
408
+ method = "#{key}="
409
+
410
+ if respond_to?(method)
411
+ return send(method, value)
412
+ else
413
+ return nil
414
+ end
415
+ end
287
416
  end
288
417
  end
289
418
  end
@@ -23,9 +23,13 @@ module Authlete
23
23
  class SnsCredentials
24
24
  # The API key. (String)
25
25
  attr_accessor :apiKey
26
+ alias_method :api_key, :apiKey
27
+ alias_method :api_key=, :apiKey=
26
28
 
27
29
  # The API secret. (String)
28
30
  attr_accessor :apiSecret
31
+ alias_method :api_secret, :apiSecret
32
+ alias_method :api_secret=, :apiSecret=
29
33
 
30
34
  # The SNS. (String)
31
35
  #
@@ -37,6 +41,12 @@ module Authlete
37
41
  # String attributes.
38
42
  STRING_ATTRIBUTES = ::Set.new([:apiKey, :apiSecret, :sns])
39
43
 
44
+ # Mapping from snake cases to camel cases.
45
+ SNAKE_TO_CAMEL = {
46
+ :api_key => :apiKey,
47
+ :api_secret => :apiSecret
48
+ }
49
+
40
50
  # The constructor.
41
51
  def initialize(hash = nil)
42
52
  # Set default values to string attributes.
@@ -48,6 +58,17 @@ module Authlete
48
58
  authlete_model_snsCredentials_update(hash)
49
59
  end
50
60
 
61
+ def authlete_model_snsCredentials_to_key(key)
62
+ key = key.to_sym
63
+
64
+ # Convert snakecase to camelcase, if necessary.
65
+ if SNAKE_TO_CAMEL.has_key?(key)
66
+ key = SNAKE_TO_CAMEL[key]
67
+ end
68
+
69
+ return key
70
+ end
71
+
51
72
  def authlete_model_snsCredentials_simple_attribute?(key)
52
73
  STRING_ATTRIBUTES.include?(key)
53
74
  end
@@ -58,7 +79,7 @@ module Authlete
58
79
  end
59
80
 
60
81
  hash.each do |key, value|
61
- key = key.to_sym
82
+ key = authlete_model_snsCredentials_to_key(key)
62
83
 
63
84
  # If the attribute is a simple one.
64
85
  if authlete_model_snsCredentials_simple_attribute?(key)
@@ -102,6 +123,27 @@ module Authlete
102
123
 
103
124
  return hash
104
125
  end
126
+
127
+ def [](key)
128
+ key = authlete_model_snsCredentials_to_key(key)
129
+
130
+ if respond_to?(key)
131
+ return send(key)
132
+ else
133
+ return nil
134
+ end
135
+ end
136
+
137
+ def []=(key, value)
138
+ key = authlete_model_snsCredentials_to_key(key)
139
+ method = "#{key}="
140
+
141
+ if respond_to?(method)
142
+ return send(method, value)
143
+ else
144
+ return nil
145
+ end
146
+ end
105
147
  end
106
148
  end
107
149
  end
@@ -1,3 +1,3 @@
1
1
  module Authlete
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlete
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiko Kawasaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-24 00:00:00.000000000 Z
11
+ date: 2015-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client