lib/mrkt/concerns/crud_asset_static_lists.rb

Summary

Maintainability
A
15 mins
Test Coverage
A
100%
module Mrkt
  module CrudAssetStaticLists
    def create_static_list(name, folder, description: nil)
      post('/rest/asset/v1/staticLists.json') do |req|
        params = {
          name: name,
          folder: JSON.generate(folder)
        }

        optional = {
          description: description
        }

        req.body = merge_params(params, optional)
      end
    end

    def get_static_list_by_id(id)
      get("/rest/asset/v1/staticList/#{id}.json")
    end

    def get_static_list_by_name(name)
      get('/rest/asset/v1/staticList/byName.json', name: name)
    end

    def delete_static_list(id)
      post("/rest/asset/v1/staticList/#{id}/delete.json")
    end
  end
end