Class: Moltin::Api::RestClientWrapper
- Inherits:
-
Object
- Object
- Moltin::Api::RestClientWrapper
- Defined in:
- lib/moltin/api/rest_client_wrapper.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #get ⇒ Object
-
#initialize(path, custom_headers = {}) ⇒ RestClientWrapper
constructor
A new instance of RestClientWrapper.
- #post(data) ⇒ Object
- #put(data) ⇒ Object
Constructor Details
#initialize(path, custom_headers = {}) ⇒ RestClientWrapper
Returns a new instance of RestClientWrapper.
5 6 7 8 9 10 11 12 13 |
# File 'lib/moltin/api/rest_client_wrapper.rb', line 5 def initialize(path, custom_headers = {}) @instance = RestClient::Resource.new( Moltin::Api::Request.build_endpoint(path), { verify_ssl: OpenSSL::SSL::VERIFY_NONE, headers: Moltin::Api::Request.headers(custom_headers), } ) end |
Instance Method Details
#delete ⇒ Object
33 34 35 36 37 |
# File 'lib/moltin/api/rest_client_wrapper.rb', line 33 def delete @instance.delete do |response| yield response end end |
#get ⇒ Object
15 16 17 18 19 |
# File 'lib/moltin/api/rest_client_wrapper.rb', line 15 def get @instance.get do |response| yield response end end |
#post(data) ⇒ Object
21 22 23 24 25 |
# File 'lib/moltin/api/rest_client_wrapper.rb', line 21 def post data @instance.post data do |response| yield response end end |
#put(data) ⇒ Object
27 28 29 30 31 |
# File 'lib/moltin/api/rest_client_wrapper.rb', line 27 def put data @instance.put data do |response| yield response end end |