class ConoStorage::Response

Attributes

faraday_response[RW]

Public Class Methods

new(faraday_response) click to toggle source
# File lib/cono_storage/response.rb, line 5
def initialize(faraday_response)
  @body    = faraday_response.body
  @headers = faraday_response.headers
  @status  = faraday_response.status
  @url     = faraday_response.env[:url].to_s
  @faraday_response = faraday_response
end

Public Instance Methods

body() click to toggle source

Conostorage::Response#body

@return [Hash] @return [Array] @return [String] JSON以外で返ってきた場合はそのまま出力

# File lib/cono_storage/response.rb, line 27
def body
  if @body and @body.size > 0
    JSON.parse(@body)
  else
    @body
  end
rescue JSON::ParserError
  @body
end
headers() click to toggle source

Conostorage::Response#headers

@return [Hash]

# File lib/cono_storage/response.rb, line 41
def headers
  @headers
end
status() click to toggle source

Conostorage::Response#status

@return [Fixnum]

# File lib/cono_storage/response.rb, line 17
def status
  @status
end
url() click to toggle source

Conostorage::Response#url

@return [String] Web ModeにするとアクセスできるオブジェクトのURL

# File lib/cono_storage/response.rb, line 49
def url
  @url
end