Class: KnapsackPro::Client::Connection
- Inherits:
-
Object
- Object
- KnapsackPro::Client::Connection
- Defined in:
- lib/knapsack_pro/client/connection.rb
Constant Summary collapse
- TIMEOUT =
30
- REQUEST_RETRY_TIMEBOX =
2
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.
7 8 9 |
# File 'lib/knapsack_pro/client/connection.rb', line 7 def initialize(action) @action = action end |
Instance Method Details
#call ⇒ Object
11 12 13 |
# File 'lib/knapsack_pro/client/connection.rb', line 11 def call send(action.http_method) end |
#errors? ⇒ Boolean
19 20 21 |
# File 'lib/knapsack_pro/client/connection.rb', line 19 def errors? !!(response && (response['errors'] || response['error'])) end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/knapsack_pro/client/connection.rb', line 15 def success? !!response end |