Module: PlentyClient::Concerns::RestRoutes
- Included in:
- Warehouse, Warehouse::Location, Warehouse::Location::Dimension, Warehouse::Location::Level
- Defined in:
- lib/plenty_client/concerns/rest_routes.rb
Instance Method Summary collapse
- #create(headers = {}, &block) ⇒ Object
- #destroy(id, headers = {}, &block) ⇒ Object
- #find(id, headers = {}, &block) ⇒ Object
- #list(headers = {}, &block) ⇒ Object
-
#skip_rest_routes(*paths) ⇒ Object
Undefines class methods in modules/classes extending this module.
- #update(id, headers = {}, &block) ⇒ Object
Instance Method Details
#create(headers = {}, &block) ⇒ Object
53 54 55 |
# File 'lib/plenty_client/concerns/rest_routes.rb', line 53 def create(headers = {}, &block) post(base_path, headers, &block) end |
#destroy(id, headers = {}, &block) ⇒ Object
69 70 71 |
# File 'lib/plenty_client/concerns/rest_routes.rb', line 69 def destroy(id, headers = {}, &block) delete(single_path(id), headers, &block) end |
#find(id, headers = {}, &block) ⇒ Object
61 62 63 |
# File 'lib/plenty_client/concerns/rest_routes.rb', line 61 def find(id, headers = {}, &block) get(single_path(id), headers, &block) end |
#list(headers = {}, &block) ⇒ Object
57 58 59 |
# File 'lib/plenty_client/concerns/rest_routes.rb', line 57 def list(headers = {}, &block) get(base_path, headers, &block) end |
#skip_rest_routes(*paths) ⇒ Object
Undefines class methods in modules/classes extending this module. You don’t have to do it if you overload the method explicitly.
47 48 49 50 51 |
# File 'lib/plenty_client/concerns/rest_routes.rb', line 47 def skip_rest_routes(*paths) instance_exec(paths) do |p| p.each { |mn| undef :"#{mn}" } end end |
#update(id, headers = {}, &block) ⇒ Object
65 66 67 |
# File 'lib/plenty_client/concerns/rest_routes.rb', line 65 def update(id, headers = {}, &block) put(single_path(id), headers, &block) end |