Module: Cloudinary

Defined in:
lib/cloudinary/version.rb,
lib/cloudinary.rb,
lib/cloudinary/cache.rb,
lib/cloudinary/config.rb,
lib/cloudinary/auth_token.rb,
lib/cloudinary/base_config.rb,
lib/cloudinary/account_config.rb

Overview

Copyright Cloudinary

Defined Under Namespace

Modules: AccountConfig, AuthToken, BaseApi, BaseConfig, Cache, CarrierWave, CloudinaryController, Config, FormBuilder Classes: AccountApi, Api, Blob, Downloader, Engine, Migrator, PreloadedFile, Railtie, Search, Static, Uploader, Utils

Constant Summary collapse

CF_SHARED_CDN =
"d3jpl91pxevbkh.cloudfront.net"
AKAMAI_SHARED_CDN =
"res.cloudinary.com"
OLD_AKAMAI_SHARED_CDN =
"cloudinary-a.akamaihd.net"
SHARED_CDN =
AKAMAI_SHARED_CDN
USER_AGENT =
"CloudinaryRuby/#{VERSION} (Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL})"
FORMAT_ALIASES =
{
  "jpeg" => "jpg",
  "jpe"  => "jpg",
  "tif"  => "tiff",
  "ps"   => "eps",
  "ept"  => "eps"
}
VERSION =
"1.20.0"
@@user_platform =
defined?(Rails.version) ? "Rails/#{Rails.version}" : ""

Class Method Summary collapse

Class Method Details

.account_config(new_config = nil) {|Account| ... } ⇒ OpenStruct

Cloudinary account config

Parameters:

  • new_config (Hash) (defaults to: nil)

    If new_config is passed, Account Config will be updated with it

Yield Parameters:

  • Account (OpenStruct)

    config can be updated in the block

Returns:


87
88
89
90
91
92
93
94
# File 'lib/cloudinary.rb', line 87

def self.(new_config=nil)
  @@account_config ||= make_new_config(AccountConfig)

  @@account_config.update(new_config) if new_config
  yield @@account_config if block_given?

  @@account_config
end

.app_rootObject


104
105
106
107
108
109
110
111
# File 'lib/cloudinary.rb', line 104

def self.app_root
  if defined? Rails::root
    # Rails 2.2 return String for Rails.root
    Rails.root.is_a?(Pathname) ? Rails.root : Pathname.new(Rails.root)
  else
    Pathname.new(".")
  end
end

.config(new_config = nil) {|Config| ... } ⇒ OpenStruct

Cloudinary config

Parameters:

  • new_config (Hash) (defaults to: nil)

    If new_config is passed, Config will be updated with it

Yield Parameters:

  • Config (OpenStruct)

    can be updated in the block

Returns:


72
73
74
75
76
77
78
79
# File 'lib/cloudinary.rb', line 72

def self.config(new_config=nil)
  @@config ||= make_new_config(Config)

  @@config.update(new_config) if new_config
  yield @@config if block_given?

  @@config
end

.config_from_account_url(url) ⇒ Object


100
101
102
# File 'lib/cloudinary.rb', line 100

def self.(url)
  .load_from_url(url)
end

.config_from_url(url) ⇒ Object


96
97
98
# File 'lib/cloudinary.rb', line 96

def self.config_from_url(url)
  config.load_from_url(url)
end

.USER_AGENTObject


50
51
52
53
54
55
56
# File 'lib/cloudinary.rb', line 50

def self.USER_AGENT
  if @@user_platform.empty?
    USER_AGENT
  else
    "#{@@user_platform} #{USER_AGENT}"
  end
end

.user_platformObject


46
47
48
# File 'lib/cloudinary.rb', line 46

def self.user_platform
  @@user_platform
end

.user_platform=(value) ⇒ Object

Add platform information to the USER_AGENT header This is intended for platform information and not individual applications!


42
43
44
# File 'lib/cloudinary.rb', line 42

def self.user_platform=(value)
  @@user_platform= value
end