Module: Zendesk
- Defined in:
- lib/zendesk.rb,
lib/zendesk/helpers.rb,
lib/zendesk/railtie.rb,
lib/zendesk/routing.rb,
lib/zendesk/version.rb,
lib/zendesk/controller.rb
Overview
Zendesk remote authentication helper for Rails. Implements JS generation, controller actions and route helpers. Have a look at the code, because it is more explanatory than a thousand words :-)
Kudos to the Zendesk staff for such a simple and effective interface.
© 2010 Panmind, Released under the terms of the Ruby License. © 2011 [email protected]
- vjt Wed May 18 23:01:09 CEST 2011
Defined Under Namespace
Modules: Controller, Helpers, Routing Classes: ConfigurationError, Railtie
Constant Summary collapse
- Version =
'1.2.0'
Class Attribute Summary collapse
-
.css_asset_name ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.css_asset_path ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.dropbox ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
.js_asset_name ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.js_asset_path ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.login ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.login_url ⇒ Object
TODO these should become attr_readers and we set @variables directly.
-
.token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
- .auth_url ⇒ Object
- .check_configuration! ⇒ Object
- .enabled? ⇒ Boolean
- .return_url ⇒ Object
- .support_url ⇒ Object
Class Attribute Details
.css_asset_name ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def css_asset_name @css_asset_name end |
.css_asset_path ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def css_asset_path @css_asset_path end |
.dropbox ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def dropbox @dropbox end |
.hostname ⇒ Object
Returns the value of attribute hostname.
22 23 24 |
# File 'lib/zendesk.rb', line 22 def hostname @hostname end |
.js_asset_name ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def js_asset_name @js_asset_name end |
.js_asset_path ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def js_asset_path @js_asset_path end |
.login ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def login @login end |
.login_url ⇒ Object
TODO these should become attr_readers and we set @variables directly
29 30 31 |
# File 'lib/zendesk.rb', line 29 def login_url @login_url end |
.token ⇒ Object
Returns the value of attribute token.
22 23 24 |
# File 'lib/zendesk.rb', line 22 def token @token end |
Class Method Details
.auth_url ⇒ Object
24 |
# File 'lib/zendesk.rb', line 24 def auth_url; @auth_url ||= "http://#{hostname}/access/remote/".freeze end |
.check_configuration! ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/zendesk.rb', line 31 def check_configuration! = Rails.application.config.zendesk rescue nil bail "Zendesk configuration missing: please define config.zendesk" unless .present? self.token, self.hostname, self.login, self.login_url = .values_at(:token, :hostname, :login, :login_url) bail "API token is missing" unless self.token.present? bail "Support hostname is missing" unless self.hostname.present? bail "Login proc is missing" unless self.login.present? bail "Login URL named route is missing" unless self.login_url.present? # Dropbox specific customizations, defaults in place self.dropbox = ([:dropbox] || {}).reverse_merge( :dropboxID => 'feedback', :url => Zendesk.hostname ).freeze # Path and name for css and asset required for zenbox 2.0 self.js_asset_path = [:js_asset_path] || '//assets0.zendesk.com/external/zenbox' self.js_asset_name = [:js_asset_name] || 'zenbox-2.0' self.css_asset_path = [:css_asset_path] || '//assets0.zendesk.com/external/zenbox' self.css_asset_name = [:css_asset_name] || 'zenbox-2.0' end |
.enabled? ⇒ Boolean
57 58 59 60 61 |
# File 'lib/zendesk.rb', line 57 def enabled? # FIXME we should not disable this code in the # test environment, rather test it appropriately Rails.env.production? || Rails.env.development? end |
.return_url ⇒ Object
25 |
# File 'lib/zendesk.rb', line 25 def return_url; @return_url ||= "http://#{hostname}/login".freeze end |
.support_url ⇒ Object
26 |
# File 'lib/zendesk.rb', line 26 def support_url; @support_url ||= "http://#{hostname}/home".freeze end |