Class: DocFox::Profile::GetService
- Inherits:
-
BaseService
- Object
- BaseService
- DocFox::Profile::GetService
- Defined in:
- lib/doc_fox/profile/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 profile.
-
#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/profile/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/profile/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/profile/get_service.rb', line 4 def params @params end |
Instance Method Details
#call ⇒ Object
Get a profile.
Examples
service = DocFox::Profile::GetService.call(id: '')
service.success? # => true
service.errors # => #<ActiveModel::Errors []>
service.response # => #<Faraday::Response ...>
service.response.status # => 200
service.response.body # => {}
service.facade # => #<DocFox::Profile::Facade ...>
service.facade.id
service.id
service.relationships.dig('names', 'data', 'id')
service.relationships.dig('numbers', 'links', 'related')
Include related resources.
service = DocFox::Profile::GetService.call(id: '', params: { include: 'names,numbers,additional_details' })
GET /api/v2/profiles/:id
44 45 46 |
# File 'lib/doc_fox/profile/get_service.rb', line 44 def call connection.get("profiles/#{id}", **params) end |