Class: VertxAuthOauth2::OAuth2Response

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb

Overview

A response from a fetch request. This class represents a secure response from a Oauth2 fetch call. A fetch is a simplified HTTP response from a protected resource.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 24

def @@j_api_type.accept?(obj)
  obj.class == OAuth2Response
end

+ (Object) j_api_type



33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 33

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 36

def self.j_class
  Java::IoVertxExtAuthOauth2::OAuth2Response.java_class
end

+ (Object) unwrap(obj)



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 30

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 27

def @@j_api_type.wrap(obj)
  OAuth2Response.new(obj)
end

Instance Method Details

- (::Vertx::Buffer) body

The HTTP response body as a buffer

Returns:



83
84
85
86
87
88
89
90
91
92
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 83

def body
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:body, []).call(),::Vertx::Buffer)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling body()"
  end
end

- (String) getHeader(name)

Looks up a HTTP response header by name, in case where the response is a list of headers, the first one is returned.

Parameters:

  • name (String)
    of the header to look up

Returns:

  • (String)
    the single value for the header.


111
112
113
114
115
116
117
118
119
120
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 111

def get_header(*args)
  if args[0].class == String && !block_given?
    return @j_del.java_method(:getHeader, [Java::java.lang.String.java_class]).call(args[0])
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_header(#{args[0]})"
  end
end

- (::Vertx::MultiMap) headers

The HTTP response headers from the HTTP layer.

Returns:



42
43
44
45
46
47
48
49
50
51
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 42

def headers
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:headers, []).call(),::Vertx::MultiMap)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling headers()"
  end
end

- (true, false) is(contentType)

Helper to analize the response body. The test is performed against the header Content-Type, the content of the body is not analyzed.

Parameters:

  • contentType (String)
    a content type to test, e.g.: application/json

Returns:

  • (true, false)
    true if the header matches


57
58
59
60
61
62
63
64
65
66
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 57

def is?(*args)
  if args[0].class == String && !block_given?
    return @j_del.java_method(:is, [Java::java.lang.String.java_class]).call(args[0])
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling is?(#{args[0]})"
  end
end

- (Array<String,Object>) jsonArray

The HTTP response body as a JsonArray

Returns:

  • (Array<String,Object>)
    a JsonArray from the HTTP response body


96
97
98
99
100
101
102
103
104
105
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 96

def json_array
  if !block_given?
    return @j_del.java_method(:jsonArray, []).call() != nil ? JSON.parse(@j_del.java_method(:jsonArray, []).call().encode) : nil
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling json_array()"
  end
end

- (Hash{String => Object}) jsonObject

The HTTP response body as a JsonObject

Returns:

  • (Hash{String => Object})
    a JsonObject from the HTTP response body


70
71
72
73
74
75
76
77
78
79
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 70

def json_object
  if !block_given?
    return @j_del.java_method(:jsonObject, []).call() != nil ? JSON.parse(@j_del.java_method(:jsonObject, []).call().encode) : nil
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling json_object()"
  end
end

- (Fixnum) statusCode

the returned status code from the HTTP layer.

Returns:

  • (Fixnum)
    HTTP status code


124
125
126
127
128
129
130
131
132
133
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_response.rb', line 124

def status_code
  if !block_given?
    return @j_del.java_method(:statusCode, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling status_code()"
  end
end