Sha256: 8666d2c102ecd483363a492d6ff55131abb21de057f54d68b8cb491a92471d2b

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

require "dato/api_client"
require "dato/upload/file"
require "dato/upload/create_upload_path"

module Dato
  module Site
    class Client
      include ApiClient

      json_schema "site-api"

      def create_upload_path(path_or_url)
        file = Upload::CreateUploadPath.new(self, path_or_url)
        file.upload_path
      end

      def upload_file(path_or_url, upload_attributes = {}, field_attributes = {})
        file = Upload::File.new(self, path_or_url, upload_attributes, field_attributes)
        file.upload
      end

      def upload_image(path_or_url, upload_attributes = {}, field_attributes = {})
        file = Upload::File.new(self, path_or_url, upload_attributes, field_attributes)
        file.upload
      end

      def pusher_token(socket_id, channel)
        request(
          :post,
          "/pusher/authenticate",
          { socket_id: socket_id, channel_name: channel },
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.8.3 lib/dato/site/client.rb
dato-0.8.2 lib/dato/site/client.rb
dato-0.8.1 lib/dato/site/client.rb