Sha256: ebd7474c5ae6c0c4266b1d9c9b645b67bee95f54f8c2b18927a335b5a8449296

Contents?: true

Size: 990 Bytes

Versions: 1

Compression:

Stored size: 990 Bytes

Contents

module Voog
  class API
    module LayoutAssets
      
      # List layouts assets
      def layout_assets(params = {})
        paginate 'layout_assets', {query: params}
      end

      # Get a single layout asset
      def layout_asset(id, params = {})
        get "layout_assets/#{id}", {query: params}
      end

      # Create a layout asset
      def create_layout_asset(data)
        if data && data.key?(:file)
          data = data.dup
          data[:file] = Faraday::UploadIO.new(data[:file], data[:content_type])
          options = {multipart: true}
        end

        post 'layout_assets', data, (options || {})
      end

      # Update a layout asset
      def update_layout_asset(id, data)
        if data && data.key?(:file)
          data[:data] = File.read data.delete(:file)
        end
        put "layout_assets/#{id}", data
      end

      # Delete a layout asset
      def delete_layout_asset(id)
        delete "layout_assets/#{id}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voog_api-0.0.10 lib/voog_api/api/layout_assets.rb