Class: KnapsackPro::Client::Connection
- Inherits:
-
Object
- Object
- KnapsackPro::Client::Connection
- Defined in:
- lib/knapsack_pro/client/connection.rb
Constant Summary collapse
- TIMEOUT =
15
Instance Method Summary collapse
- #call ⇒ Object
- #errors? ⇒ Boolean
-
#initialize(action) ⇒ Connection
constructor
A new instance of Connection.
- #success? ⇒ Boolean
Constructor Details
#initialize(action) ⇒ Connection
Returns a new instance of Connection.
6 7 8 |
# File 'lib/knapsack_pro/client/connection.rb', line 6 def initialize(action) @action = action end |
Instance Method Details
#call ⇒ Object
10 11 12 |
# File 'lib/knapsack_pro/client/connection.rb', line 10 def call send(action.http_method) end |
#errors? ⇒ Boolean
18 19 20 |
# File 'lib/knapsack_pro/client/connection.rb', line 18 def errors? !!(response && (response['errors'] || response['error'])) end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/knapsack_pro/client/connection.rb', line 14 def success? !!response end |