Class: MPI::Responses::FindProfileResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/mpi/responses/find_profile_response.rb

Constant Summary collapse

STATUS =
[OK = :ok, NOT_FOUND = :not_found, SERVER_ERROR = :server_error].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, profile: nil, error: nil) ⇒ FindProfileResponse

Returns a new instance of FindProfileResponse.



10
11
12
13
14
# File 'lib/mpi/responses/find_profile_response.rb', line 10

def initialize(status:, profile: nil, error: nil)
  @status = status
  @profile = profile
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



6
7
8
# File 'lib/mpi/responses/find_profile_response.rb', line 6

def error
  @error
end

#profileObject (readonly)

Returns the value of attribute profile.



6
7
8
# File 'lib/mpi/responses/find_profile_response.rb', line 6

def profile
  @profile
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/mpi/responses/find_profile_response.rb', line 6

def status
  @status
end

Instance Method Details

#cache?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/mpi/responses/find_profile_response.rb', line 16

def cache?
  ok? || not_found?
end

#not_found?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/mpi/responses/find_profile_response.rb', line 24

def not_found?
  @status == NOT_FOUND
end

#ok?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/mpi/responses/find_profile_response.rb', line 20

def ok?
  @status == OK
end

#server_error?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/mpi/responses/find_profile_response.rb', line 28

def server_error?
  @status == SERVER_ERROR
end