Class: Naver::Client
- Inherits:
-
Object
- Object
- Naver::Client
- Defined in:
- lib/naver/client.rb
Overview
Common functionality across Naver API objects.
Class Method Summary collapse
-
.connection ⇒ Naver::Connection
The connection object being used to communicate with Naver.
-
.connection=(conn) ⇒ Naver::Connection
Assign a default connection object.
-
.parse(body) ⇒ Object
Converts the response body to an ObjectifiedHash.
Instance Method Summary collapse
-
#connection ⇒ Naver::Connection
The connection object being used to communicate with Naver.
Class Method Details
.connection ⇒ Naver::Connection
The connection object being used to communicate with Naver.
32 33 34 |
# File 'lib/naver/client.rb', line 32 def connection @@connection ||= Connection.new end |
.connection=(conn) ⇒ Naver::Connection
Assign a default connection object.
39 40 41 |
# File 'lib/naver/client.rb', line 39 def connection=(conn) @@connection = conn end |
.parse(body) ⇒ Object
Converts the response body to an ObjectifiedHash.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |
Instance Method Details
#connection ⇒ Naver::Connection
The connection object being used to communicate with Naver.
6 7 8 |
# File 'lib/naver/client.rb', line 6 def connection self.class.connection end |