Class: EVSS::Letters::LettersResponse
- Inherits:
-
Response
- Object
- Common::Base
- Response
- EVSS::Letters::LettersResponse
- Defined in:
- lib/evss/letters/letters_response.rb
Overview
Model for a letter service response, containing the recipient’s name and an array of letter objects
Constant Summary
Constants included from Common::Client::Concerns::ServiceStatus
Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS
Instance Attribute Summary collapse
-
#full_name ⇒ String
The recipient’s full name.
-
#letters ⇒ Array[EVSS::Letters::Letter]
An array of the user’s letters.
Attributes inherited from Common::Base
Instance Method Summary collapse
-
#initialize(status, response = nil) ⇒ LettersResponse
constructor
A new instance of LettersResponse.
Methods inherited from Response
#cache?, #metadata, #ok?, #response_status
Methods inherited from Common::Base
#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes
Constructor Details
#initialize(status, response = nil) ⇒ LettersResponse
Returns a new instance of LettersResponse.
25 26 27 28 29 30 31 32 33 |
# File 'lib/evss/letters/letters_response.rb', line 25 def initialize(status, response = nil) if response attributes = { letters: response.body['letters'], full_name: response.body.dig('letter_destination', 'full_name') } end super(status, attributes) end |
Instance Attribute Details
#full_name ⇒ String
Returns The recipient’s full name.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/letters/letters_response.rb', line 21 class LettersResponse < EVSS::Response attribute :letters, Array[EVSS::Letters::Letter] attribute :full_name, String def initialize(status, response = nil) if response attributes = { letters: response.body['letters'], full_name: response.body.dig('letter_destination', 'full_name') } end super(status, attributes) end end |
#letters ⇒ Array[EVSS::Letters::Letter]
Returns An array of the user’s letters.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evss/letters/letters_response.rb', line 21 class LettersResponse < EVSS::Response attribute :letters, Array[EVSS::Letters::Letter] attribute :full_name, String def initialize(status, response = nil) if response attributes = { letters: response.body['letters'], full_name: response.body.dig('letter_destination', 'full_name') } end super(status, attributes) end end |