Class: DocFox::Document::GetService
- Inherits:
-
BaseService
- Object
- BaseService
- DocFox::Document::GetService
- Defined in:
- lib/doc_fox/document/get_service.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#call ⇒ Object
Get a document.
-
#initialize(id:, params: {}) ⇒ GetService
constructor
A new instance of GetService.
Constructor Details
#initialize(id:, params: {}) ⇒ GetService
Returns a new instance of GetService.
12 13 14 15 |
# File 'lib/doc_fox/document/get_service.rb', line 12 def initialize(id:, params: {}) @id = id @params = params end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/doc_fox/document/get_service.rb', line 4 def id @id end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/doc_fox/document/get_service.rb', line 4 def params @params end |
Instance Method Details
#call ⇒ Object
Get a document.
Examples
service = DocFox::Document::GetService.call(id: '')
service.success? # => true
service.errors # => #<ActiveModel::Errors []>
service.response # => #<Faraday::Response ...>
service.response.status # => 200
service.response.body # => {}
service.facade # => #<DocFox::Document::Facade ...>
service.facade.id
service.id
service.relationships.dig('evidence_submissions', 'data')
service.relationships.dig('document_tokens', 'links', 'related')
Include related resources.
service = DocFox::Document::GetService.call(id: '', params: { include: 'evidence_submissions' })
service.included
GET /api/v2/documents/:id
45 46 47 |
# File 'lib/doc_fox/document/get_service.rb', line 45 def call connection.get("documents/#{id}", **params) end |