Class: Cocoafish::Connection
- Inherits:
-
Object
- Object
- Cocoafish::Connection
- Defined in:
- lib/cocoafish/connection.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
Instance Method Summary collapse
- #delete(endpoint, data = nil) ⇒ Object
- #get(endpoint, data = nil) ⇒ Object
-
#initialize(token, secret, options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #post(endpoint, data = nil) ⇒ Object
- #put(endpoint, data = nil) ⇒ Object
Constructor Details
#initialize(token, secret, options = {}) ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 10 11 12 13 |
# File 'lib/cocoafish/connection.rb', line 6 def initialize(token, secret, = {}) @key = token @secret = secret @cookies = Hash.new @options = @user_agent = @options.delete(:user_agent) @user_agent = "Cocoafish Ruby Client v#{CLIENT_VERSION}" if !@user_agent end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/cocoafish/connection.rb', line 4 def debug @debug end |
#session_id ⇒ Object
Returns the value of attribute session_id.
4 5 6 |
# File 'lib/cocoafish/connection.rb', line 4 def session_id @session_id end |
Instance Method Details
#delete(endpoint, data = nil) ⇒ Object
19 20 21 |
# File 'lib/cocoafish/connection.rb', line 19 def delete(endpoint, data=nil) request :delete, endpoint, data end |
#get(endpoint, data = nil) ⇒ Object
15 16 17 |
# File 'lib/cocoafish/connection.rb', line 15 def get(endpoint, data=nil) request :get, endpoint, data end |
#post(endpoint, data = nil) ⇒ Object
23 24 25 |
# File 'lib/cocoafish/connection.rb', line 23 def post(endpoint, data=nil) request :post, endpoint, data end |
#put(endpoint, data = nil) ⇒ Object
27 28 29 |
# File 'lib/cocoafish/connection.rb', line 27 def put(endpoint, data=nil) request :put, endpoint, data end |