Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fizzy_api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Compsy
fizzy_api
Merge requests
!7
Added synchronous call functionality, refactored the architecture a bit
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Added synchronous call functionality, refactored the architecture a bit
gh-23000649/7/roqua/fb-add-render_sync-routes
into
master
Overview
2
Commits
2
Pipelines
0
Changes
14
Merged
automation_daan
requested to merge
gh-23000649/7/roqua/fb-add-render_sync-routes
into
master
8 years ago
Overview
2
Commits
2
Pipelines
0
Changes
14
Expand
Created by: frbl
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
e405c9fb
2 commits,
7 years ago
14 files
+
476
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
14
Search (e.g. *.vue) (Ctrl+P)
lib/fizzy/api/calculate_outcome.rb
→
lib/fizzy/api/
endpoints/
calculate_outcome.rb
+
32
−
0
Options
module
Fizzy
module
Api
class
CalculateOutcome
<
ActiveInteraction
::
Base
string
:dossier_id
string
:protocol_subscription_id
module
Endpoints
class
CalculateOutcome
<
Endpoint
string
:dossier_id
string
:protocol_subscription_id
def
execute
response
=
Api
.
basic_auth_session
.
post
(
"/dossier/
#{
dossier_id
}
"
\
"/protocol_subscriptions/
#{
protocol_subscription_id
}
"
\
'/calculate'
)
process_response
(
response
)
end
private
def
process_response
(
response
)
case
response
.
code
when
200
response
else
invalid_response
(
response
)
def
execute
response
=
Api
.
basic_auth_session
.
post
(
"/dossier/
#{
dossier_id
}
"
\
"/protocol_subscriptions/
#{
protocol_subscription_id
}
"
\
'/calculate'
)
process_response
(
response
)
end
end
def
invalid_response
(
response
)
case
response
.
code
when
202
raise
Errors
::
OutcomeNotAvailableError
,
response
.
body
||
'The results are currently being calculated.'
when
404
raise
Errors
::
GraphNotFoundError
,
response
.
body
||
'Participant not found, or graph not supported.'
else
raise
Errors
::
UnexpectedStatusError
,
"Status code
#{
response
.
code
}
not expected."
private
def
invalid_response
(
response
)
case
response
.
code
when
202
raise
(
Errors
::
OutcomeNotAvailableError
,
select_measurement_text
(
response
.
body
,
'The results are currently being calculated.'
))
when
404
raise
Errors
::
GraphNotFoundError
,
select_measurement_text
(
response
.
body
,
'Participant not found, or graph not supported.'
)
else
raise
Errors
::
UnexpectedStatusError
,
"Status code
#{
response
.
code
}
not expected."
end
end
end
end
Loading