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, options = {}) ⇒ Rest
constructor
A new instance of Rest.
- #post(options) ⇒ Object
- #put(options) ⇒ Object
Constructor Details
#initialize(endpoint, actions, options = {}) ⇒ Rest
6 7 8 9 10 11 |
# File 'lib/ecal_client/api/rest.rb', line 6 def initialize(endpoint, actions, = {}) @endpoint = endpoint @actions = actions @key = [:key] @secret = [:secret] end |
Instance Method Details
#get(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/ecal_client/api/rest.rb', line 13 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
22 23 24 25 26 |
# File 'lib/ecal_client/api/rest.rb', line 22 def post() raise Unsupported unless supported?(:post) response = post_call(@endpoint, {}, , headers) Response.new(response) end |
#put(options) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/ecal_client/api/rest.rb', line 28 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 |