Module: PeepShot

Defined in:
lib/peepshot.rb,
lib/peepshot/rails.rb,
lib/peepshot/rails/helpers.rb,
lib/peepshot/rails/helpers/image_tags.rb

Defined Under Namespace

Modules: Rails Classes: NotConfigured

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



4
5
6
# File 'lib/peepshot.rb', line 4

def api_key
  @api_key
end

.api_secretObject

Returns the value of attribute api_secret.



4
5
6
# File 'lib/peepshot.rb', line 4

def api_secret
  @api_secret
end

Class Method Details

.configuration=(hash) ⇒ Object



19
20
21
22
# File 'lib/peepshot.rb', line 19

def self.configuration=(hash)
  self.api_key = hash[:api_key]
  self.api_secret = hash[:api_secret]
end

.load_peepshot_yamlObject

Raises:



24
25
26
27
28
# File 'lib/peepshot.rb', line 24

def self.load_peepshot_yaml
  config = (YAML.load(ERB.new(File.read(File.join(::Rails.root,"config","peepshot.yml"))).result)[::Rails.env])
  raise NotConfigured.new("Unable to load configuration for #{::Rails.env} from peepshot.yml. Is it set up?") if config.nil?
  self.configuration = config.with_indifferent_access
end

.raise_unconfigured_exceptionObject

Raises:



15
16
17
# File 'lib/peepshot.rb', line 15

def self.raise_unconfigured_exception
  raise NotConfigured.new("No configuration provided for PeepShot. Either set the api_key and api_secret or call PeepShot.load_peepshot_yaml in an initializer")
end