Class: YACCL::Services::Internal::BrowserBindingService
- Inherits:
-
Object
- Object
- YACCL::Services::Internal::BrowserBindingService
- Defined in:
- lib/yaccl/services/internal/browser_binding_service.rb
Defined Under Namespace
Classes: Basement
Instance Method Summary collapse
-
#initialize(service_url) ⇒ BrowserBindingService
constructor
A new instance of BrowserBindingService.
- #perform_request(required_params = {}, optional_params = {}) ⇒ Object
Constructor Details
#initialize(service_url) ⇒ BrowserBindingService
Returns a new instance of BrowserBindingService.
11 12 13 |
# File 'lib/yaccl/services/internal/browser_binding_service.rb', line 11 def initialize(service_url) @service_url = service_url end |
Instance Method Details
#perform_request(required_params = {}, optional_params = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/yaccl/services/internal/browser_binding_service.rb', line 15 def perform_request(required_params={}, optional_params={}) url = get_url(required_params.delete(:repositoryId), required_params[:objectId]) optional_params.reject! { |_, v| v.nil? } params = transform_hash(required_params.merge(optional_params)) check(params) response = if params.has_key?(:cmisaction) if params.has_key?(:content) Basement.multipart_post(url, params) else Basement.post(url, body: params) end else Basement.get(url, query: params) end result = response.body if response.content_type == 'application/json' result = MultiJson.load(result, symbolize_keys: true) if result.is_a?(Hash) && result.has_key?(:exception) raise CMISRequestError, "#{result[:exception]} -- #{result[:message]}" end end result end |