authlete 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,6 +84,11 @@ module Authlete
84
84
  alias_method :developer_authentication_callback_endpoint, :developerAuthenticationCallbackEndpoint
85
85
  alias_method :developer_authentication_callback_endpoint=, :developerAuthenticationCallbackEndpoint=
86
86
 
87
+ # The list of SNS credentials for developer login. (SnsCredentials array)
88
+ attr_accessor :developerSnsCredentials
89
+ alias_method :developer_sns_credentials, :developerSnsCredentials
90
+ alias_method :developer_sns_credentials=, :developerSnsCredentials=
91
+
87
92
  # The duration of ID tokens in seconds. (Integer)
88
93
  attr_accessor :idTokenDuration
89
94
  alias_method :id_token_duration, :idTokenDuration
@@ -168,6 +173,11 @@ module Authlete
168
173
  alias_method :supported_claim_types, :supportedClaimTypes
169
174
  alias_method :supported_claim_types=, :supportedClaimTypes=
170
175
 
176
+ # The list of supported SNSes for developer login. (Sns array)
177
+ attr_accessor :supportedDeveloperSnses
178
+ alias_method :supported_developer_snses, :supportedDeveloperSnses
179
+ alias_method :supported_developer_snses=, :supportedDeveloperSnses=
180
+
171
181
  # The list of supported values of +display+ parameter. (String array)
172
182
  #
173
183
  # Valid values are "PAGE", "POPUP", "TOUCH" and "WAP".
@@ -251,9 +261,9 @@ module Authlete
251
261
  # String array attributes.
252
262
  STRING_ARRAY_ATTRIBUTES = ::Set.new([
253
263
  :properties, :supportedAcrs, :supportedClaimLocales, :supportedClaims,
254
- :supportedClaimTypes, :supportedDisplays, :supportedGrantTypes,
255
- :supportedResponseTypes, :supportedSnses, :supportedTokenAuthMethods,
256
- :supportedUiLocales
264
+ :supportedClaimTypes, :supportedDeveloperSnses, :supportedDisplays,
265
+ :supportedGrantTypes, :supportedResponseTypes, :supportedSnses,
266
+ :supportedTokenAuthMethods, :supportedUiLocales
257
267
  ])
258
268
 
259
269
  # Mapping from snake cases to camel cases.
@@ -269,6 +279,7 @@ module Authlete
269
279
  :developer_authentication_callback_apiKey => :developerAuthenticationCallbackApiKey,
270
280
  :developer_authentication_callback_api_secret => :developerAuthenticationCallbackApiSecret,
271
281
  :developer_authentication_callback_endpoint => :developerAuthenticationCallbackEndpoint,
282
+ :developer_sns_credentials => :developerSnsCredentials,
272
283
  :created_at => :createdAt,
273
284
  :id_tokn_duration => :idTokenDuration,
274
285
  :jwks_uri => :jwksUri,
@@ -284,6 +295,7 @@ module Authlete
284
295
  :supported_claim_locales => :supportedClaimLocales,
285
296
  :supported_claims => :supportedClaims,
286
297
  :supported_claim_types => :supportedClaimTypes,
298
+ :supported_developer_snses => :supportedDeveloperSnses,
287
299
  :supported_displays => :supportedDisplays,
288
300
  :supported_grant_types => :supportedGrantTypes,
289
301
  :supported_response_types => :supportedResponseTypes,
@@ -314,8 +326,9 @@ module Authlete
314
326
  end
315
327
 
316
328
  # Set default values to special objects.
317
- @snsCredentials = nil
318
- @supportedScopes = nil
329
+ @developerSnsCredentials = nil
330
+ @snsCredentials = nil
331
+ @supportedScopes = nil
319
332
 
320
333
  # Set attribute values using the given hash.
321
334
  authlete_model_service_update(hash)
@@ -352,7 +365,12 @@ module Authlete
352
365
  next
353
366
  end
354
367
 
355
- if key == :snsCredentials
368
+ if key == :developerSnsCredentials
369
+ # The attribute 'developerSnsCredentials'.
370
+ @developerSnsCredentials = authlete_model_service_parse_array(value) do |element|
371
+ Authlete::Model::SnsCredentials.parse(element)
372
+ end
373
+ elsif key == :snsCredentials
356
374
  # The attribute 'snsCredentials'.
357
375
  @snsCredentials = authlete_model_service_parse_array(value) do |element|
358
376
  Authlete::Model::SnsCredentials.parse(element)
@@ -1,135 +1,135 @@
1
- # :nodoc:
2
- #
3
- # Copyright (C) 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
- class TaggedValue
24
- # The language tag part. (String)
25
- attr_accessor :tag
26
-
27
- # The value part. (String)
28
- attr_accessor :value
29
-
30
-
31
- private
32
-
33
- # String attributes.
34
- STRING_ATTRIBUTES = ::Set.new([:tag, :value])
35
-
36
- # The constructor
37
- def initialize(hash = new)
38
- # Set default values to string attributes.
39
- STRING_ATTRIBUTES.each do |attr|
40
- send("#{attr}=", nil)
41
- end
42
-
43
- # Set attribute values using the given hash.
44
- authlete_model_taggedValue_update(hash)
45
- end
46
-
47
- def authlete_model_taggedValue_to_key(key)
48
- key = key.to_sym
49
-
50
- # Convert snakecase to camelcase, if necessary.
51
- if SNAKE_TO_CAMEL.has_key?(key)
52
- key = SNAKE_TO_CAMEL[key]
53
- end
54
-
55
- return key
56
- end
57
-
58
- def authlete_model_taggedValue_simple_attribute?(key)
59
- STRING_ATTRIBUTES.include?(key)
60
- end
61
-
62
- def authlete_model_taggedValue_update(hash)
63
- if hash.nil?
64
- return
65
- end
66
-
67
- hash.each do |key, value|
68
- key = authlete_model_taggedValue_to_key(key)
69
-
70
- # If the attribute is a simple one.
71
- if authlete_model_taggedValue_simple_attribute?(key)
72
- send("#{key}=", value)
73
- next
74
- end
75
- end
76
-
77
- return self
78
- end
79
-
80
- public
81
-
82
- # Construct an instance from the given hash.
83
- #
84
- # If the given argument is nil or is not a Hash, nil is returned.
85
- # Otherwise, TaggedValue.new(hash) is returned.
86
- def self.parse(hash)
87
- if hash.nil? or (hash.kind_of?(Hash) == false)
88
- return nil
89
- end
90
-
91
- return Authlete::Model::TaggedValue.new(hash)
92
- end
93
-
94
- # Set attribute values using the given hash.
95
- def update(hash)
96
- authlete_model_taggedValue_update(hash)
97
- end
98
-
99
- # Convert this object into a hash.
100
- def to_hash
101
- hash = {}
102
-
103
- instance_variables.each do |var|
104
- key = var.to_s.delete("@").to_sym
105
- val = instance_variable_get(var)
106
-
107
- hash[key] = val
108
- end
109
-
110
- return hash
111
- end
112
-
113
- def [](key)
114
- key = authlete_model_taggedValue_to_key(key)
115
-
116
- if respond_to?(key)
117
- return send(key)
118
- else
119
- return nil
120
- end
121
- end
122
-
123
- def []=(key, value)
124
- key = authlete_model_taggedValue_to_key(key)
125
- method = "#{key}="
126
-
127
- if respond_to?(method)
128
- return send(method, value)
129
- else
130
- return nil
131
- end
132
- end
133
- end
134
- end
135
- end
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 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
+ class TaggedValue
24
+ # The language tag part. (String)
25
+ attr_accessor :tag
26
+
27
+ # The value part. (String)
28
+ attr_accessor :value
29
+
30
+
31
+ private
32
+
33
+ # String attributes.
34
+ STRING_ATTRIBUTES = ::Set.new([:tag, :value])
35
+
36
+ # The constructor
37
+ def initialize(hash = new)
38
+ # Set default values to string attributes.
39
+ STRING_ATTRIBUTES.each do |attr|
40
+ send("#{attr}=", nil)
41
+ end
42
+
43
+ # Set attribute values using the given hash.
44
+ authlete_model_taggedValue_update(hash)
45
+ end
46
+
47
+ def authlete_model_taggedValue_to_key(key)
48
+ key = key.to_sym
49
+
50
+ # Convert snakecase to camelcase, if necessary.
51
+ if SNAKE_TO_CAMEL.has_key?(key)
52
+ key = SNAKE_TO_CAMEL[key]
53
+ end
54
+
55
+ return key
56
+ end
57
+
58
+ def authlete_model_taggedValue_simple_attribute?(key)
59
+ STRING_ATTRIBUTES.include?(key)
60
+ end
61
+
62
+ def authlete_model_taggedValue_update(hash)
63
+ if hash.nil?
64
+ return
65
+ end
66
+
67
+ hash.each do |key, value|
68
+ key = authlete_model_taggedValue_to_key(key)
69
+
70
+ # If the attribute is a simple one.
71
+ if authlete_model_taggedValue_simple_attribute?(key)
72
+ send("#{key}=", value)
73
+ next
74
+ end
75
+ end
76
+
77
+ return self
78
+ end
79
+
80
+ public
81
+
82
+ # Construct an instance from the given hash.
83
+ #
84
+ # If the given argument is nil or is not a Hash, nil is returned.
85
+ # Otherwise, TaggedValue.new(hash) is returned.
86
+ def self.parse(hash)
87
+ if hash.nil? or (hash.kind_of?(Hash) == false)
88
+ return nil
89
+ end
90
+
91
+ return Authlete::Model::TaggedValue.new(hash)
92
+ end
93
+
94
+ # Set attribute values using the given hash.
95
+ def update(hash)
96
+ authlete_model_taggedValue_update(hash)
97
+ end
98
+
99
+ # Convert this object into a hash.
100
+ def to_hash
101
+ hash = {}
102
+
103
+ instance_variables.each do |var|
104
+ key = var.to_s.delete("@").to_sym
105
+ val = instance_variable_get(var)
106
+
107
+ hash[key] = val
108
+ end
109
+
110
+ return hash
111
+ end
112
+
113
+ def [](key)
114
+ key = authlete_model_taggedValue_to_key(key)
115
+
116
+ if respond_to?(key)
117
+ return send(key)
118
+ else
119
+ return nil
120
+ end
121
+ end
122
+
123
+ def []=(key, value)
124
+ key = authlete_model_taggedValue_to_key(key)
125
+ method = "#{key}="
126
+
127
+ if respond_to?(method)
128
+ return send(method, value)
129
+ else
130
+ return nil
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
@@ -1,6 +1,6 @@
1
1
  # :nodoc:
2
2
  #
3
- # Copyright (C) 2014 Authlete, Inc.
3
+ # Copyright (C) 2014-2015 Authlete, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -32,12 +32,16 @@ module Authlete
32
32
  # Pieces of information about the end-user in JSON format.
33
33
  attr_accessor :claims
34
34
 
35
+ # True to indicate that the authentication endpoint is mock.
36
+ attr_accessor :mock
37
+
35
38
  # The constructor which takes a hash that represents a JSON response
36
39
  # from an authentication callback endpoint.
37
40
  def initialize(hash = {})
38
41
  @authenticated = extract_boolean_value(hash, :authenticated)
39
42
  @subject = extract_value(hash, :subject)
40
43
  @claims = extract_value(hash, :claims)
44
+ @mock = extract_boolean_value(hash, :mock)
41
45
  end
42
46
 
43
47
  # Generate an array which is usable as a Rack response from this instance.
@@ -45,7 +49,8 @@ module Authlete
45
49
  to_rack_response_json(200, JSON.generate(
46
50
  :authenticated => @authenticated,
47
51
  :subject => @subject,
48
- :claims => @claims
52
+ :claims => @claims,
53
+ :mock => @mock
49
54
  ))
50
55
  end
51
56
  end
@@ -0,0 +1,60 @@
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 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
+ module Authlete
19
+ module Response
20
+ # == Authlete::Response::DeveloperAuthenticationCallbackResponse class
21
+ #
22
+ # This class represents a response from a developer authentication callback endpoint.
23
+ class DeveloperAuthenticationCallbackResponse
24
+ include Authlete::Utility
25
+
26
+ # True when the developer has been authenticated (= is a valid developer).
27
+ attr_accessor :authenticated
28
+
29
+ # The unique identifier of the developer.
30
+ attr_accessor :subject
31
+
32
+ # The display name of the developer.
33
+ attr_accessor :displayName
34
+ alias_method :display_name, :displayName
35
+ alias_method :display_name=, :displayName=
36
+
37
+ # True to indicate that the developer authentication endpoint is mock.
38
+ attr_accessor :mock
39
+
40
+ # The constructor which takes a hash that represents a JSON response
41
+ # from a developer authentication callback endpoint.
42
+ def initialize(hash = {})
43
+ @authenticated = extract_boolean_value(hash, :authenticated)
44
+ @subject = extract_value(hash, :subject)
45
+ @displayName = extract_value(hash, :displayName)
46
+ @mock = extract_boolean_value(hash, :mock)
47
+ end
48
+
49
+ # Generate an array which is usable as a Rack response from this instance.
50
+ def to_rack_response
51
+ to_rack_response_json(200, JSON.generate(
52
+ :authenticated => @authenticated,
53
+ :subject => @subject,
54
+ :displayName => @displayName,
55
+ :mock => @mock
56
+ ))
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,3 +1,3 @@
1
1
  module Authlete
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlete
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
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-08-11 00:00:00.000000000 Z
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.7.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.7.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  description: A library for Authlete Web APIs. See https://www.authlete.com/authlete_web_apis.html
@@ -60,7 +60,7 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
63
+ - .gitignore
64
64
  - Gemfile
65
65
  - LICENSE.txt
66
66
  - README.md
@@ -81,6 +81,7 @@ files:
81
81
  - lib/authlete/request/authentication-callback-request.rb
82
82
  - lib/authlete/response/authentication-callback-response.rb
83
83
  - lib/authlete/response/base-response.rb
84
+ - lib/authlete/response/developer-authentication-callback-response.rb
84
85
  - lib/authlete/response/introspection-response.rb
85
86
  - lib/authlete/utility.rb
86
87
  - lib/authlete/version.rb
@@ -94,17 +95,17 @@ require_paths:
94
95
  - lib
95
96
  required_ruby_version: !ruby/object:Gem::Requirement
96
97
  requirements:
97
- - - ">="
98
+ - - ! '>='
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  requirements:
102
- - - ">="
103
+ - - ! '>='
103
104
  - !ruby/object:Gem::Version
104
105
  version: '0'
105
106
  requirements: []
106
107
  rubyforge_project:
107
- rubygems_version: 2.4.6
108
+ rubygems_version: 2.3.0
108
109
  signing_key:
109
110
  specification_version: 4
110
111
  summary: A library for Authlete Web APIs