Sha256: 5b853f18e7d3de5801953967e67770318d3adff941393629826a7fba6a7e9c53

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

## CarrierWave example

### carrierwave-aws

**Create initializer**

```ruby
DerivationEndpoint.configure do |config|
  config.host   = "http://localhost:3000"
  config.prefix = "derivation_endpoints"

  config.encoder = ->(method_value) { method_value.file.path }
  config.decoder = ->(path, options) do
    uploader = options[:uploader].constantize
    storage  = CarrierWave::Storage::AWS.new(uploader)

    CarrierWave::Storage::AWSFile.new(uploader, storage.connection, path).url
  end
end
```

**Mount derivation endpoint**

```ruby
mount DerivationEndpoint::Derivation.new => DerivationEndpoint.derivation_path
```

**Update model**

```ruby
class Post < ApplicationRecord
  extend DerivationEndpoint

  mount_uploader :file, FileUploader

  derivation_endpoint :file, options: { uploader: FileUploader }
end
```

### Fog [coming soon]
  - AWS
  - Google
  - Rackspace
  - OpenStack
  - AzureRM

### File [coming soon]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
derivation_endpoint-0.1.0 docs/carrierwave.md