authlete 0.3.4 → 0.3.5
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.
- checksums.yaml +4 -4
- data/authlete.gemspec +1 -1
- data/lib/authlete/api.rb +469 -469
- data/lib/authlete/model/client-list.rb +181 -181
- data/lib/authlete/model/client.rb +492 -492
- data/lib/authlete/model/service-owner.rb +177 -174
- data/lib/authlete/model/tagged-value.rb +135 -135
- data/lib/authlete/version.rb +2 -2
- metadata +4 -4
@@ -1,174 +1,177 @@
|
|
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
|
-
class ServiceOwner
|
24
|
-
# The API key of the service owner. (Long)
|
25
|
-
attr_accessor :apiKey
|
26
|
-
alias_method :api_key, :apiKey
|
27
|
-
alias_method :api_key=, :apiKey=
|
28
|
-
|
29
|
-
# The API secret of the service owner. (String)
|
30
|
-
attr_accessor :apiSecret
|
31
|
-
alias_method :api_secret, :apiSecret
|
32
|
-
alias_method :api_secret=, :apiSecret=
|
33
|
-
|
34
|
-
# The email address of the service owner. (String)
|
35
|
-
attr_accessor :email
|
36
|
-
|
37
|
-
# The login ID of the service owner. (String)
|
38
|
-
attr_accessor :loginId
|
39
|
-
alias_method :login_id, :loginId
|
40
|
-
alias_method :login_id=, :loginId=
|
41
|
-
|
42
|
-
# The service owner name. (String)
|
43
|
-
attr_accessor :name
|
44
|
-
|
45
|
-
# The service owner number. (Integer)
|
46
|
-
attr_accessor :number
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
#
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
end
|
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
|
+
class ServiceOwner
|
24
|
+
# The API key of the service owner. (Long)
|
25
|
+
attr_accessor :apiKey
|
26
|
+
alias_method :api_key, :apiKey
|
27
|
+
alias_method :api_key=, :apiKey=
|
28
|
+
|
29
|
+
# The API secret of the service owner. (String)
|
30
|
+
attr_accessor :apiSecret
|
31
|
+
alias_method :api_secret, :apiSecret
|
32
|
+
alias_method :api_secret=, :apiSecret=
|
33
|
+
|
34
|
+
# The email address of the service owner. (String)
|
35
|
+
attr_accessor :email
|
36
|
+
|
37
|
+
# The login ID of the service owner. (String)
|
38
|
+
attr_accessor :loginId
|
39
|
+
alias_method :login_id, :loginId
|
40
|
+
alias_method :login_id=, :loginId=
|
41
|
+
|
42
|
+
# The service owner name. (String)
|
43
|
+
attr_accessor :name
|
44
|
+
|
45
|
+
# The service owner number. (Integer)
|
46
|
+
attr_accessor :number
|
47
|
+
|
48
|
+
# The plan. (String)
|
49
|
+
attr_accessor :plan
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
# Integer attributes.
|
54
|
+
INTEGER_ATTRIBUTES = ::Set.new([
|
55
|
+
:apiKey, :number
|
56
|
+
])
|
57
|
+
|
58
|
+
# String attributes.
|
59
|
+
STRING_ATTRIBUTES = ::Set.new([
|
60
|
+
:apiSecret, :email, :loginId, :name, :plan
|
61
|
+
])
|
62
|
+
|
63
|
+
# Mapping from snake cases to camel cases.
|
64
|
+
SNAKE_TO_CAMEL = {
|
65
|
+
:api_key => :apiKey,
|
66
|
+
:api_secret => :apiSecret,
|
67
|
+
:login_id => :loginId
|
68
|
+
}
|
69
|
+
|
70
|
+
# The constructor
|
71
|
+
def initialize(hash = nil)
|
72
|
+
# Set default values to integer attributes.
|
73
|
+
INTEGER_ATTRIBUTES.each do |attr|
|
74
|
+
send("#{attr}=", 0)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Set default values to string attributes.
|
78
|
+
STRING_ATTRIBUTES.each do |attr|
|
79
|
+
send("#{attr}=", nil)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Set attribute values using the given hash.
|
83
|
+
authlete_model_service_update(hash)
|
84
|
+
end
|
85
|
+
|
86
|
+
def authlete_model_service_to_key(key)
|
87
|
+
key = key.to_sym
|
88
|
+
|
89
|
+
# Convert snakecase to camelcase, if necessary.
|
90
|
+
if SNAKE_TO_CAMEL.has_key?(key)
|
91
|
+
key = SNAKE_TO_CAMEL[key]
|
92
|
+
end
|
93
|
+
|
94
|
+
return key
|
95
|
+
end
|
96
|
+
|
97
|
+
def authlete_model_service_simple_attribute?(key)
|
98
|
+
INTEGER_ATTRIBUTES.include?(key) or
|
99
|
+
STRING_ATTRIBUTES.include?(key)
|
100
|
+
end
|
101
|
+
|
102
|
+
def authlete_model_service_update(hash)
|
103
|
+
if hash.nil?
|
104
|
+
return
|
105
|
+
end
|
106
|
+
|
107
|
+
hash.each do |key, value|
|
108
|
+
key = authlete_model_service_to_key(key)
|
109
|
+
|
110
|
+
# If the attribute is a simple one.
|
111
|
+
if authlete_model_service_simple_attribute?(key)
|
112
|
+
send("#{key}=", value)
|
113
|
+
next
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
return self
|
118
|
+
end
|
119
|
+
|
120
|
+
public
|
121
|
+
|
122
|
+
# Construct an instance from the given hash.
|
123
|
+
#
|
124
|
+
# If the given argument is nil or is not a Hash, nil is returned.
|
125
|
+
# Otherwise, Service.new(hash) is returned.
|
126
|
+
def self.parse(hash)
|
127
|
+
if hash.nil? or (hash.kind_of?(Hash) == false)
|
128
|
+
return nil
|
129
|
+
end
|
130
|
+
|
131
|
+
return Service.new(hash)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Set attribute values using the given hash.
|
135
|
+
def update(hash)
|
136
|
+
authlete_model_service_update(hash)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Convert this object into a hash.
|
140
|
+
def to_hash
|
141
|
+
hash = {}
|
142
|
+
|
143
|
+
instance_variables.each do |var|
|
144
|
+
key = var.to_s.delete("@").to_sym
|
145
|
+
val = instance_variable_get(var)
|
146
|
+
|
147
|
+
if authlete_model_service_simple_attribute?(key) or val.nil?
|
148
|
+
hash[key] = val
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
return hash
|
153
|
+
end
|
154
|
+
|
155
|
+
def [](key)
|
156
|
+
key = authlete_model_service_to_key(key)
|
157
|
+
|
158
|
+
if respond_to?(key)
|
159
|
+
return send(key)
|
160
|
+
else
|
161
|
+
return nil
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def []=(key, value)
|
166
|
+
key = authlete_model_service_to_key(key)
|
167
|
+
method = "#{key}="
|
168
|
+
|
169
|
+
if respond_to?(method)
|
170
|
+
return send(method, value)
|
171
|
+
else
|
172
|
+
return nil
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
@@ -1,135 +1,135 @@
|
|
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
|
-
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) 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
|
+
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
|