Sha256: 0f9a4163d93df4362c969868a40b58b8ce487f3158a5fcafc2072234667a8d37

Contents?: true

Size: 1.45 KB

Versions: 54

Compression:

Stored size: 1.45 KB

Contents

class Ey::Core::Client
  class Real
    # Create a log.
    #
    # params - A  hash of log params:
    #   component_action_id - A component action id (required).
    #   log - A hash of log attributes:
    #     file - File body.
    #     filename - The name of the log file.
    #     mime_type - The file mime type.
    #
    # Returns the created log.
    def create_log(params={})
      query_params = {"log" => params["log"]}
      component_action_id = params["component_action_id"]
      body = query_params.to_json

      request(
        :method => :post,
        :path   => "/component-actions/#{component_action_id}/logs",
        :body => body
      )
    end
  end # Real

  class Mock
    def create_log(params={})
      log_id = self.uuid
      log_params = params["log"]

      filename = log_params["filename"]

      log = {
        "id"               => log_id,
        "filename"         => filename,
        "download_url"     => "http://s3.amazon.com/#{filename}",
        "uplaod_url"       => nil,
        "created_at"       => Time.now,
        "updated_at"       => Time.now,
        "deleted_at"       => nil,
        "mime_type"        => params[:mime_type] || "application/json",
        "component_action" => nil, # @fixme support genuine component actions
        "server"           => params["server"],
      }

      self.data[:logs][log_id] = log
      response(
        :body => {"log" => log},
        :status => 201
      )
    end
  end # Mock
end

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
ey-core-3.6.0.autoscaling1 lib/ey-core/requests/create_log.rb
ey-core-3.6.4 lib/ey-core/requests/create_log.rb
ey-core-3.6.3 lib/ey-core/requests/create_log.rb
ey-core-3.6.1 lib/ey-core/requests/create_log.rb
groove-ey-core-3.6.3 lib/ey-core/requests/create_log.rb
groove-ey-core-3.6.2 lib/ey-core/requests/create_log.rb
groove-ey-core-3.6.1 lib/ey-core/requests/create_log.rb
ey-core-3.5.0 lib/ey-core/requests/create_log.rb
ey-core-3.4.4 lib/ey-core/requests/create_log.rb
ey-core-3.4.2 lib/ey-core/requests/create_log.rb
ey-core-3.4.1 lib/ey-core/requests/create_log.rb
ey-core-3.4.0 lib/ey-core/requests/create_log.rb
ey-core-3.3.1 lib/ey-core/requests/create_log.rb
ey-core-3.3.0 lib/ey-core/requests/create_log.rb
ey-core-3.2.6 lib/ey-core/requests/create_log.rb
ey-core-3.2.5 lib/ey-core/requests/create_log.rb
ey-core-3.2.4 lib/ey-core/requests/create_log.rb
ey-core-3.2.3 lib/ey-core/requests/create_log.rb
ey-core-3.2.2 lib/ey-core/requests/create_log.rb
ey-core-3.2.1 lib/ey-core/requests/create_log.rb