authlete 0.4.1 → 0.4.2

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: 82936474309206c929f213e650c466e8b3b5e9fd
4
- data.tar.gz: 3e99cc8e876bbb5b27f558d4d56d2e9b7b53663d
3
+ metadata.gz: ab0dea663641f59f6f122fb29dcf71efb7f2cec8
4
+ data.tar.gz: c54970c03b22d27edaaa072b174a4512e8cf8067
5
5
  SHA512:
6
- metadata.gz: 22c790f2fb9243ca50114a02fe77a4ca5c2ced9c7d40e9c85b85a25802bb36ca0e2fa1b2c7cc3c034ad93d8cf2549d350b741cf6935ca1db18f8ad114481114d
7
- data.tar.gz: 1003c046225523684c56be97c1667bebdf55ace7cb32fa8127651272c3a203b58ebb9fce5ab47338c570d223f081672871d80ed0a83062c4dc323d14b262081d
6
+ metadata.gz: 20ed509dc656372f88babd36d812969c58e333c08675df697d52bad23802e572be239decbbff89db509cc95b8b6c69390ae83f89a95eb6a056e20b6ed8c00dd6
7
+ data.tar.gz: 962d058d75905062b4721d361ea0288483fbb5954c4542a50cd742634d03560a474dc192c91a3036e3f185304954915cbad7b3e76dd4dd2e69e25af00ab707db
data/lib/authlete.rb CHANGED
@@ -25,7 +25,6 @@ module Authlete
25
25
  autoload :AuthenticationServer, 'authlete/authentication-server'
26
26
  autoload :Api, 'authlete/api'
27
27
  autoload :Exception, 'authlete/exception'
28
- autoload :Host, 'authlete/host'
29
28
  autoload :Utility, 'authlete/utility'
30
29
 
31
30
  module Model
@@ -227,4 +227,4 @@ module Authlete
227
227
  '/authentication'
228
228
  end
229
229
  end
230
- end
230
+ end
@@ -247,7 +247,7 @@ module Authlete
247
247
  # (String)
248
248
  attr_accessor :description
249
249
 
250
- # Descriptions about the client application with language tags. (TaggesValue array)
250
+ # Descriptions about the client application with language tags. (TaggedValue array)
251
251
  attr_accessor :descriptions
252
252
 
253
253
  # The timestamp at which the client was created. (Integer)
@@ -99,4 +99,4 @@ module Authlete
99
99
  end
100
100
  end
101
101
  end
102
- end
102
+ end
@@ -82,4 +82,4 @@ module Authlete
82
82
  end
83
83
  end
84
84
  end
85
- end
85
+ end
@@ -37,4 +37,4 @@ module Authlete
37
37
  end
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -99,4 +99,4 @@ module Authlete
99
99
  end
100
100
  end
101
101
  end
102
- end
102
+ end
@@ -119,4 +119,4 @@ module Authlete
119
119
  end
120
120
  end
121
121
  end
122
- end
122
+ end
@@ -46,4 +46,4 @@ module Authlete
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -162,4 +162,4 @@ module Authlete
162
162
  end
163
163
  end
164
164
  end
165
- end
165
+ end
@@ -130,4 +130,4 @@ module Authlete
130
130
  end
131
131
  end
132
132
  end
133
- end
133
+ end
@@ -47,4 +47,4 @@ module Authlete
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -47,4 +47,4 @@ module Authlete
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -21,9 +21,14 @@ require 'set'
21
21
  module Authlete
22
22
  module Model
23
23
  class Scope < Authlete::Model::Hashable
24
+ include Authlete::Utility
24
25
  # The description about this scope. (String)
25
26
  attr_accessor :description
26
27
 
28
+ # The descriptions about this scope with language tags.
29
+ # (TaggedValue array)
30
+ attr_accessor :descriptions
31
+
27
32
  # The name of this scope. (String)
28
33
  attr_accessor :name
29
34
 
@@ -41,6 +46,9 @@ module Authlete
41
46
  # String attributes.
42
47
  STRING_ATTRIBUTES = ::Set.new([ :description, :name ])
43
48
 
49
+ # Tagged value array attributes.
50
+ TAGGED_VALUE_ARRAY_ATTRIBUTES = ::Set.new([ :descriptions ])
51
+
44
52
  # Mapping from snake cases to camel cases.
45
53
  SNAKE_TO_CAMEL = { :default_entry => :defaultEntry }
46
54
 
@@ -56,6 +64,11 @@ module Authlete
56
64
  send("#{attr}=", nil)
57
65
  end
58
66
 
67
+ # Set default values to tagged value array attributes.
68
+ TAGGED_VALUE_ARRAY_ATTRIBUTES.each do |attr|
69
+ send("#{attr}=", nil)
70
+ end
71
+
59
72
  # Set attribute values using the given hash.
60
73
  authlete_model_update(hash)
61
74
  end
@@ -84,6 +97,13 @@ module Authlete
84
97
 
85
98
  if authlete_model_simple_attribute?(key)
86
99
  send("#{key}=", value)
100
+ elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)
101
+ # Get an array consisting of "TaggedValue" objects.
102
+ parsed = get_parsed_array(value) do |element|
103
+ Authlete::Model::TaggedValue.parse(element)
104
+ end
105
+
106
+ send("#{key}=", parsed)
87
107
  end
88
108
  end
89
109
 
@@ -117,7 +137,11 @@ module Authlete
117
137
  key = var.to_s.delete("@").to_sym
118
138
  val = instance_variable_get(var)
119
139
 
120
- hash[key] = val
140
+ if authlete_model_simple_attribute?(key) or val.nil?
141
+ hash[key] = val
142
+ elsif val.kind_of?(Array)
143
+ hash[key] = val.map { |element| element.to_hash }
144
+ end
121
145
  end
122
146
 
123
147
  hash
@@ -30,7 +30,7 @@ module Authlete
30
30
  private
31
31
 
32
32
  # String attributes.
33
- STRING_ATTRIBUTES = ::Set.new([:tag, :value])
33
+ STRING_ATTRIBUTES = ::Set.new([ :tag, :value ])
34
34
 
35
35
  # The constructor
36
36
  def initialize(hash = nil)
@@ -44,14 +44,7 @@ module Authlete
44
44
  end
45
45
 
46
46
  def authlete_model_convert_key(key)
47
- key = key.to_sym
48
-
49
- # Convert snakecase to camelcase, if necessary.
50
- if SNAKE_TO_CAMEL.has_key?(key)
51
- key = SNAKE_TO_CAMEL[key]
52
- end
53
-
54
- key
47
+ key.to_sym
55
48
  end
56
49
 
57
50
  def authlete_model_simple_attribute?(key)
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module Authlete
19
- VERSION = "0.4.1"
19
+ VERSION = "0.4.2"
20
20
  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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiko Kawasaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -70,7 +70,6 @@ files:
70
70
  - lib/authlete/api.rb
71
71
  - lib/authlete/authentication-server.rb
72
72
  - lib/authlete/exception.rb
73
- - lib/authlete/host.rb
74
73
  - lib/authlete/model/client-list.rb
75
74
  - lib/authlete/model/client.rb
76
75
  - lib/authlete/model/hashable.rb
data/lib/authlete/host.rb DELETED
@@ -1,23 +0,0 @@
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
- module Authlete
19
- module Host
20
- DEVELOPMENT = 'https://dev-api.authlete.com'
21
- PRODUCTION = 'https://api.authlete.com'
22
- end
23
- end