authlete 0.3.5 → 0.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4aaab5425356be5724c51aee890b2422069ebdc7
4
- data.tar.gz: b9180ce3235c85f1c6022a7769870aefb4923bb4
3
+ metadata.gz: 84a8446a852c5b0aece8b3f18a299407ed29e6fa
4
+ data.tar.gz: c5ead8e2f82f26ab7b9549a75cbd3cd1eb595dc9
5
5
  SHA512:
6
- metadata.gz: 1d02a680cdaceb5ec904611703b70e9b899115165a7ab6e122078867b9673889380580c777201cabb6dbfe031fc9b1375347e16e658fb805db26d1d9f51d63f6
7
- data.tar.gz: cbe1496dd8af326ebeaa3cf96e0b334e74c10d3be28267871d79f3ca257185bfd9b10444f228eb9eb822c11b84931dd4175304ab0612d39f5617e3ff16e7bb91
6
+ metadata.gz: bf07053faa5d79fb84a58f71f70ed17a41a9700d7bffb8b9b6440ab8c9799f1a1589dd548198838f047bced62b5425d942f94b74cb79317883503aa908cc9290
7
+ data.tar.gz: 55e6a410992f0e9c8019e70e175da08176bbf2d4adbd4a441e9f8011eb7601c560cd958896cb9f805e0a8ebc43785fdd88d221e38f62ac96146f93ba009bc2c0
data/lib/authlete.rb CHANGED
@@ -50,5 +50,6 @@ module Authlete
50
50
  autoload :BaseResponse, 'authlete/response/base-response'
51
51
  autoload :DeveloperAuthenticationCallbackResponse, 'authlete/response/developer-authentication-callback-response'
52
52
  autoload :IntrospectionResponse, 'authlete/response/introspection-response'
53
+ autoload :ServiceCreatableResponse, 'authlete/response/service-creatable-response'
53
54
  end
54
55
  end
data/lib/authlete/api.rb CHANGED
@@ -218,6 +218,16 @@ module Authlete
218
218
 
219
219
  public
220
220
 
221
+ # Call Authlete's /api/service/creatable API.
222
+ #
223
+ # On success, an instance of Authlete::Response::ServiceCreatableResponse is returned.
224
+ # On error, Authlete::Exception is raised.
225
+ def service_creatable(api_key)
226
+ hash = call_api_service_owner(:get, "/api/service/creatable", nil, nil)
227
+
228
+ Authlete::Response::ServiceCreatableResponse.new(hash)
229
+ end
230
+
221
231
  # Call Authlete's /api/service/create API.
222
232
  #
223
233
  # <tt>service</tt> is the content of a new service to create. The type of
@@ -246,7 +256,6 @@ module Authlete
246
256
  call_api_service_owner(:delete, "/api/service/delete/#{api_key}", nil, nil)
247
257
  end
248
258
 
249
-
250
259
  # Call Authlete's /api/service/get/{api_key} API.
251
260
  #
252
261
  # <tt>api_key</tt> is the API key of the service whose information
@@ -20,8 +20,7 @@ module Authlete
20
20
  # == Authlete::Response::IntrospectionResponse class
21
21
  #
22
22
  # A class that represents a response from Authlete's
23
- # {/auth/introspection}[https://www.authlete.com/authlete_web_apis_introspection.html#auth_introspection]
24
- # API.
23
+ # /api/auth/introspection API.
25
24
  #
26
25
  class IntrospectionResponse < Authlete::Response::BaseResponse
27
26
  include Authlete::Utility
@@ -58,9 +57,8 @@ module Authlete
58
57
  # should return to the client application.
59
58
  attr_accessor :response_content
60
59
 
61
- # The constructor which takes a hash that represents a JSON response from
62
- # {/auth/introspection}[https://www.authlete.com/authlete_web_apis_introspection.html#auth_introspection]
63
- # API.
60
+ # The constructor which takes a hash that represents a JSON response
61
+ # from /api/auth/introspection API.
64
62
  def initialize(hash = {})
65
63
  super(hash)
66
64
 
@@ -0,0 +1,52 @@
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::ServiceCreatableResponse class
21
+ class ServiceCreatableResponse
22
+ include Authlete::Utility
23
+
24
+ # A boolean flag to indicate whether the service owner can
25
+ # create a new service or not.
26
+ attr_accessor :creatable
27
+
28
+ # The number of services that the service owner currently has.
29
+ attr_accessor :count
30
+
31
+ # The maximum number of services allowed in the plan of the
32
+ # service owner.
33
+ attr_accessor :limit
34
+
35
+ # The plan of the service owner.
36
+ attr_accessor :plan
37
+
38
+ # The constructor which takes a hash that represents a JSON
39
+ # response from /api/service/creatable API.
40
+ def initialize(hash = {})
41
+ super(hash)
42
+
43
+ @creatable = extract_boolean_value(hash, :creatable)
44
+ @count = extract_value(hash, :count);
45
+ @limit = extract_value(hash, :limit);
46
+ @plan = extract_value(hash, :plan);
47
+ end
48
+
49
+ alias_method :creatable?, :creatable
50
+ end
51
+ end
52
+ end
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module Authlete
19
- VERSION = "0.3.5"
19
+ VERSION = "0.3.6"
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.3.5
4
+ version: 0.3.6
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-11-05 00:00:00.000000000 Z
11
+ date: 2015-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -85,6 +85,7 @@ files:
85
85
  - lib/authlete/response/base-response.rb
86
86
  - lib/authlete/response/developer-authentication-callback-response.rb
87
87
  - lib/authlete/response/introspection-response.rb
88
+ - lib/authlete/response/service-creatable-response.rb
88
89
  - lib/authlete/utility.rb
89
90
  - lib/authlete/version.rb
90
91
  homepage: https://www.authlete.com/