Class: CapsuleCRM::Connection
- Inherits:
-
Object
- Object
- CapsuleCRM::Connection
- Defined in:
- lib/capsule_crm/connection.rb
Class Method Summary collapse
- .delete(path) ⇒ Object
- .get(path, params = {}) ⇒ Object
- .post(path, params = {}) ⇒ Object
- .put(path, params = {}) ⇒ Object
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path, params) ⇒ Object
- #post(path, params) ⇒ Object
- #put(path, params) ⇒ Object
Class Method Details
.delete(path) ⇒ Object
28 29 30 |
# File 'lib/capsule_crm/connection.rb', line 28 def self.delete(path) new.delete(path) end |
.get(path, params = {}) ⇒ Object
3 4 5 |
# File 'lib/capsule_crm/connection.rb', line 3 def self.get(path, params = {}) new.get(path, params) end |
.post(path, params = {}) ⇒ Object
12 13 14 |
# File 'lib/capsule_crm/connection.rb', line 12 def self.post(path, params = {}) new.post(path, params) end |
.put(path, params = {}) ⇒ Object
20 21 22 |
# File 'lib/capsule_crm/connection.rb', line 20 def self.put(path, params = {}) new.put(path, params) end |
Instance Method Details
#delete(path) ⇒ Object
32 33 34 |
# File 'lib/capsule_crm/connection.rb', line 32 def delete(path) request(:delete, path).success? end |
#get(path, params) ⇒ Object
7 8 9 10 |
# File 'lib/capsule_crm/connection.rb', line 7 def get(path, params) preprocess_params(params) JSON.parse request(:get, path, params).body end |
#post(path, params) ⇒ Object
16 17 18 |
# File 'lib/capsule_crm/connection.rb', line 16 def post(path, params) process_post_response request(:post, path, params.to_json) end |
#put(path, params) ⇒ Object
24 25 26 |
# File 'lib/capsule_crm/connection.rb', line 24 def put(path, params) request(:put, path, params.to_json).success? end |