Module: SharkApps
- Defined in:
- lib/sharkapps.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods, ViewHelpers Classes: NotConfigured
Class Attribute Summary collapse
-
.app_id ⇒ Object
Returns the value of attribute app_id.
-
.canvas_name ⇒ Object
Returns the value of attribute canvas_name.
-
.debug_mode ⇒ Object
Returns the value of attribute debug_mode.
-
.password ⇒ Object
Returns the value of attribute password.
-
.server_url ⇒ Object
Returns the value of attribute server_url.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
- .configuration=(hash) ⇒ Object
- .included(base) ⇒ Object
- .load_sharkapps_yaml ⇒ Object
- .raise_unconfigured_exception ⇒ Object
Class Attribute Details
.app_id ⇒ Object
Returns the value of attribute app_id.
4 5 6 |
# File 'lib/sharkapps.rb', line 4 def app_id @app_id end |
.canvas_name ⇒ Object
Returns the value of attribute canvas_name.
4 5 6 |
# File 'lib/sharkapps.rb', line 4 def canvas_name @canvas_name end |
.debug_mode ⇒ Object
Returns the value of attribute debug_mode.
4 5 6 |
# File 'lib/sharkapps.rb', line 4 def debug_mode @debug_mode end |
.password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/sharkapps.rb', line 4 def password @password end |
.server_url ⇒ Object
Returns the value of attribute server_url.
4 5 6 |
# File 'lib/sharkapps.rb', line 4 def server_url @server_url end |
.username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/sharkapps.rb', line 4 def username @username end |
Class Method Details
.configuration=(hash) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/sharkapps.rb', line 41 def self.configuration=(hash) self.server_url = hash[:server_url] self.username = hash[:username] self.password = hash[:password] self.app_id = hash[:app_id] self.canvas_name = hash[:canvas_name] self.debug_mode = hash[:debug_mode] end |
.included(base) ⇒ Object
61 62 63 |
# File 'lib/sharkapps.rb', line 61 def self.included(base) base.extend(ClassMethods) end |
.load_sharkapps_yaml ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/sharkapps.rb', line 50 def self.load_sharkapps_yaml config = YAML.load(ERB.new(File.read(File.join(::Rails.root,"config","sharkapps.yml"))).result)[::Rails.env] raise NotConfigured.new("Unable to load configuration for #{::Rails.env} from sharkapps.yml. Is it set up?") if config.nil? self.configuration = config.with_indifferent_access Subscription.initialize_from_yaml AppformaAccount.initialize_from_yaml end |
.raise_unconfigured_exception ⇒ Object
37 38 39 |
# File 'lib/sharkapps.rb', line 37 def self.raise_unconfigured_exception raise NotConfigured.new("No configuration provided for Shark Apps. Call SharkApps.load_sharkapps_yaml in an initializer") end |