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