Class: Crefo::Service
- Inherits:
-
Object
- Object
- Crefo::Service
- Defined in:
- lib/crefo/service.rb,
lib/crefo/service/logon.rb,
lib/crefo/service/report.rb,
lib/crefo/service/search.rb,
lib/crefo/service/keylist.rb,
lib/crefo/service/request.rb,
lib/crefo/service/response.rb,
lib/crefo/service/logon/request.rb,
lib/crefo/service/logon/response.rb,
lib/crefo/service/report/request.rb,
lib/crefo/service/search/request.rb,
lib/crefo/service/change_password.rb,
lib/crefo/service/keylist/request.rb,
lib/crefo/service/report/response.rb,
lib/crefo/service/search/response.rb,
lib/crefo/service/keylist/response.rb,
lib/crefo/service/change_password/request.rb,
lib/crefo/service/change_password/response.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ChangePassword, Keylist, Logon, Report, Request, Response, Result, Search
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Service
constructor
A new instance of Service.
- #process ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Service
Returns a new instance of Service.
8 9 10 |
# File 'lib/crefo/service.rb', line 8 def initialize( = {}) @options = end |
Instance Attribute Details
#log ⇒ Object (readonly)
Returns the value of attribute log.
6 7 8 |
# File 'lib/crefo/service.rb', line 6 def log @log end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/crefo/service.rb', line 6 def @options end |
Instance Method Details
#process ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/crefo/service.rb', line 12 def process begin url = Crefo.config.endpoint request = self.class::Request.new(**) response_data = request.send(url) response = self.class::Response.new(response_data) rescue Crefo::Service::Response::ResponseError => exception error = true rescue Exception => exception error = %(#{exception.class}: #{exception.}\n#{exception.backtrace.join("\n")}) raise exception end Crefo::Log.new(url, (request && request.envelope), (response && response.body), error) Result.new( result: (response && response.result), body: (response && response.body), attachments: (response && response.), error: error ) end |