The app will read beers' data from the following JSON:API endpoints, available at https://peaceful-hamlet-37069.herokuapp.com/
GET /api/beers - let's call it the index endpoint
GET /api/beers/1 (where 1 is a beer's ID) - let's call it the show endpoint
On the models layer:
Define a Beer model
The show endpoint also returns a beer's ingredients, included in the JSON:API document. Let's define an Ingredient model and an ingredients getter in the Beer model (hint: use JsonApiModel's includedDocs() method)
Screen 1: Loading beers
The app will use a PersistentJsonApiAdapter
when the "Simulate offline" switch is turned on, adapter's setOffline() method should be invoked
when the "Simulate offline" switch is turned off, adapter's setOnline() method should be invoked
After the "Load beers" button is clicked:
while the load operation is in progress, an animation should be shown;
when an error occurs, a red error message should be shown in the below area, different based on the exception
on data successfully received, the next screen is shown
Screen 2: Beers list
This screen should consume data that are returned by the Beers API index endpoint. Each list item will consume some attributes that are available in the Beer model; choose the ones that you think are most relevant.
When user taps on an individual beer list item, the app navigates to the next screen.
Screen 3: Beer detail
On entering this screen, the whole set of a beer's data should be loaded by invoking the show endpoint. Hint: forceReload optional argument will need to be passed to adapter's find() method in order to prevent it from returning the cached beer record, which won't include ingredients because it was loaded with the index endpoint request.
while the load operation is in progress, an animation should be shown;
when an error occurs, a red error message should be shown in the below area, different based on the exception
on data successfully received, all of a beer's data should be shown, like this:
This screen will consume the whole set of a beer's data, including ingredients. Feel free to arrange them according to their relevance, based on your understanding.
The app will read beers' data from the following JSON:API endpoints, available at
https://peaceful-hamlet-37069.herokuapp.com/
GET /api/beers
- let's call it theindex
endpointGET /api/beers/1
(where 1 is a beer's ID) - let's call it theshow
endpointOn the models layer:
Beer
modelIngredient
model and aningredients
getter in theBeer
model (hint: useJsonApiModel
'sincludedDocs()
method)Screen 1: Loading beers
The app will use a
PersistentJsonApiAdapter
setOffline()
method should be invokedsetOnline()
method should be invokedAfter the "Load beers" button is clicked:
Screen 2: Beers list
This screen should consume data that are returned by the Beers API
index
endpoint. Each list item will consume some attributes that are available in theBeer
model; choose the ones that you think are most relevant.When user taps on an individual beer list item, the app navigates to the next screen.
Screen 3: Beer detail
On entering this screen, the whole set of a beer's data should be loaded by invoking the
show
endpoint. Hint:forceReload
optional argument will need to be passed to adapter'sfind()
method in order to prevent it from returning the cached beer record, which won't include ingredients because it was loaded with theindex
endpoint request.This screen will consume the whole set of a beer's data, including ingredients. Feel free to arrange them according to their relevance, based on your understanding.