class Naver::Client
Common functionality across Naver
API objects.
Public Class Methods
connection()
click to toggle source
The connection object being used to communicate with Naver
. @return [Naver::Connection] the connection
# File lib/naver/client.rb, line 32 def connection @@connection ||= Connection.new end
connection=(conn)
click to toggle source
Assign a default connection object. @param conn [Naver::Connection] the connection @return [Naver::Connection] the connection
# File lib/naver/client.rb, line 39 def connection=(conn) @@connection = conn end
parse(body)
click to toggle source
Converts the response body to an ObjectifiedHash
.
# File lib/naver/client.rb, line 11 def self.parse(body) if body.is_a?(Hash) body = body.deep_underscore_keys ObjectifiedHash.new(body) elsif body.is_a?(Array) body = body.deep_underscore_keys body.collect! { |e| ObjectifiedHash.new(e) } elsif body true elsif !body false elsif body.nil? false else raise Naver::Error.new("Couldn't parse a response body") end end
Public Instance Methods
connection()
click to toggle source
The connection object being used to communicate with Naver
. @return [Naver::Connection] the connection
# File lib/naver/client.rb, line 6 def connection self.class.connection end