Class: VAProfile::Models::Permission
- Includes:
- Concerns::Defaultable, Concerns::Expirable
- Defined in:
- lib/va_profile/models/permission.rb
Constant Summary collapse
- TEXT =
'TextPermission'
- PERMISSION_TYPES =
[TEXT].freeze
Constants inherited from Base
Class Method Summary collapse
-
.build_from(body) ⇒ VAProfile::Models::Permission
Converts a decoded JSON response from VAProfile to an instance of the Permission model.
Instance Method Summary collapse
-
#in_json ⇒ String
Converts an instance of the Permission model to a JSON encoded string suitable for use in the body of a request to VAProfile.
Methods included from Concerns::Expirable
#effective_end_date_has_passed
Methods included from Concerns::Defaultable
Class Method Details
.build_from(body) ⇒ VAProfile::Models::Permission
Converts a decoded JSON response from VAProfile to an instance of the Permission model
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/va_profile/models/permission.rb', line 64 def self.build_from(body) VAProfile::Models::Permission.new( id: body['permission_id'], created_at: body['create_date'], permission_type: body['permission_type'], permission_value: body['permission_value'], source_date: body['source_date'], transaction_id: body['tx_audit_id'], updated_at: body['update_date'], vet360_id: body['vet360_id'], effective_end_date: body['effective_end_date'], effective_start_date: body['effective_start_date'] ) end |
Instance Method Details
#in_json ⇒ String
Converts an instance of the Permission model to a JSON encoded string suitable for use in the body of a request to VAProfile
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/va_profile/models/permission.rb', line 45 def in_json { bio: { originatingSourceSystem: SOURCE_SYSTEM, permissionType: @permission_type, permissionValue: @permission_value, sourceDate: @source_date, sourceSystemUser: @source_system_user, permissionId: @id, vet360Id: @vet360_id, effectiveStartDate: @effective_start_date, effectiveEndDate: @effective_end_date } }.to_json end |