Class: LtiBoxEngine::Client
- Inherits:
-
Object
- Object
- LtiBoxEngine::Client
- Defined in:
- lib/lti_box_engine/client.rb
Instance Attribute Summary collapse
-
#error_message ⇒ Object
Returns the value of attribute error_message.
Class Method Summary collapse
Instance Method Summary collapse
- #authorize!(request, opts = {}) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #register_error(message) ⇒ Object
Constructor Details
#initialize ⇒ Client
10 11 12 |
# File 'lib/lti_box_engine/client.rb', line 10 def initialize = nil end |
Instance Attribute Details
#error_message ⇒ Object
Returns the value of attribute error_message.
8 9 10 |
# File 'lib/lti_box_engine/client.rb', line 8 def end |
Class Method Details
.box_url_to_box_embed_url(url) ⇒ Object
18 19 20 21 |
# File 'lib/lti_box_engine/client.rb', line 18 def self.(url) = url.strip.split('/').last "https://app.box.com/embed_widget/s/#{embed_id}?view=list&sort=name&direction=ASC&theme=blue" end |
Instance Method Details
#authorize!(request, opts = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lti_box_engine/client.rb', line 23 def (request, opts = {}) = nil key = opts['oauth_consumer_key'] tp = IMS::LTI::ToolProvider.new(key, $oauth_creds[key], opts) if !tp.valid_request?(request) register_error("The OAuth signature was invalid") return nil end if Time.now.utc.to_i - tp..to_i > 60*60 register_error("Your request is too old.") return nil end if !LtiLaunch.valid_nonce?(tp.request_oauth_nonce, 60) register_error("Nonce has already been used.") return nil end tp.extend IMS::LTI::Extensions::Content::ToolProvider return tp end |
#register_error(message) ⇒ Object
14 15 16 |
# File 'lib/lti_box_engine/client.rb', line 14 def register_error() = end |