Class: EcalClient::Api::Rest
Defined Under Namespace
Classes: Unsupported
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #get(options = {}) ⇒ Object
-
#initialize(endpoint, actions) ⇒ Rest
constructor
A new instance of Rest.
- #post(options) ⇒ Object
- #put(options) ⇒ Object
Constructor Details
#initialize(endpoint, actions) ⇒ Rest
6 7 8 9 |
# File 'lib/ecal_client/api/rest.rb', line 6 def initialize(endpoint, actions) @endpoint = endpoint @actions = actions end |
Instance Method Details
#get(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ecal_client/api/rest.rb', line 11 def get( = {}) raise Unsupported unless supported?(:get) id = .delete(:id) endpoint = @endpoint endpoint += id.to_s if id response = get_call(endpoint, , nil, headers) Response.new(response) end |
#post(options) ⇒ Object
20 21 22 23 24 |
# File 'lib/ecal_client/api/rest.rb', line 20 def post() raise Unsupported unless supported?(:post) response = post_call(@endpoint, {}, , headers) Response.new(response) end |
#put(options) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/ecal_client/api/rest.rb', line 26 def put() raise Unsupported unless supported?(:put) id = .delete(:id) endpoint = @endpoint endpoint += id.to_s if id response = put_call(endpoint, {}, , headers) Response.new(response) end |