authlete 1.0.1 → 1.0.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: 5398bbf1dfe37fca13352a9bff412f912e1d09d6
4
- data.tar.gz: 67d5554838736a7185f71312aae7cb2d0f846f33
3
+ metadata.gz: 662907ba2a7276166936aa2ed397701824927bc8
4
+ data.tar.gz: 6062abfae7550fef0ea5f4f351c52635c88c2316
5
5
  SHA512:
6
- metadata.gz: 1b2c5f318ea00c106fbb315e7abaa892a296fad0b982c05819ad647a2772123767c377ab96fa042e56bcba8b07af532458767cf8bffb920ed64f5465fd3646c6
7
- data.tar.gz: 6e3bbc794fd43e1cffe96f861b3f747ece483df940dbf71269b6c3ec660cfd85bc5c85a230415d32616027b0366c7033f12b5592fbe32cf0fcda78f2a3ce2c50
6
+ metadata.gz: 35d126adab10d831dfa28f09daf23e11b65d80b1d4f168a4930e4b9021f2caab81da72c2c607c6d0b36305cdf056621fe5231a2afbf08ca12a71a2462cf8a033
7
+ data.tar.gz: 3cd79914b05138d679df1ec92d75ecfb29998c4abb16bfbd037fb066a10695b52c6ed2b8ea1f0fa98638da05b43b7ab4be160bec0aae6002bdc9d6dc0214b96d
data/lib/authlete/api.rb CHANGED
@@ -89,6 +89,7 @@ module Authlete
89
89
 
90
90
  def execute(parameters)
91
91
  begin
92
+ puts "calling....."
92
93
  return RestClient::Request.new(parameters).execute
93
94
  rescue => e
94
95
  raise create_api_exception(e)
@@ -99,9 +100,13 @@ module Authlete
99
100
  message = exception.message
100
101
  response = exception.response
101
102
 
103
+ puts "HOGE!!!!"
104
+
102
105
  # Create a base exception.
103
106
  authlete_exception = Authlete::Exception.new(:message => message)
104
107
 
108
+ puts "After exception"
109
+
105
110
  if response.nil?
106
111
  # No response information. Then, return an exception without HTTP
107
112
  # response information.
@@ -126,8 +131,10 @@ module Authlete
126
131
  return authlete_exception
127
132
  end
128
133
 
134
+ puts "after json parse"
135
+
129
136
  # Set the Authlete API result info if it's available.
130
- if has_authlete_api_result?(json)
137
+ if has_authlete_api_result?(response_body_json)
131
138
  authlete_exception.result = Authlete::Model::Result.new(response_body_json)
132
139
  end
133
140
 
@@ -34,24 +34,37 @@ module Authlete
34
34
 
35
35
  def initialize(hash = {})
36
36
  # The error message from RestClient or the other general exceptions.
37
- @message = extract_value(hash, :message)
37
+ @message = extract_value(hash, :message)
38
+
39
+ # HTTP status code.
38
40
  @statusCode = extract_integer_value(hash, :statusCode)
39
- @result = Authlete::Model::Result.new(extract_value(hash, :result))
41
+
42
+ # Set result.
43
+ result = extract_value(hash, :result)
44
+ @result = result.nil? ? nil : Authlete::Model::Result.new(result)
40
45
  end
41
46
 
42
47
  public
43
48
 
44
- def available_message
45
- @result.resultMessage || @message || self.class.default_message
49
+ def result_code
50
+ @result && @result.resultCode
46
51
  end
47
52
 
48
- def self.default_message
49
- self.name
53
+ def result_message
54
+ @result && @result.resultMessage
55
+ end
56
+
57
+ def available_message
58
+ result_message || @message || self.class.default_message
50
59
  end
51
60
 
52
61
  def to_s
53
62
  "#{self.class.default_message} => { message:'#{@message}', status_code:'#{@statusCode}', " +
54
- "result_code:'#{@result.resultCode}', result_message:'#{@result.resultMessage}' }"
63
+ "result_code:'#{result_code}', result_message:'#{result_message}' }"
64
+ end
65
+
66
+ def self.default_message
67
+ self.name
55
68
  end
56
69
  end
57
70
  end
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module Authlete
19
- VERSION = "1.0.1"
19
+ VERSION = "1.0.2"
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlete
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiko Kawasaki