Skip to content

Commit 344118d

Browse files
committed
Various improvements
1 parent 735f417 commit 344118d

15 files changed

+37
-37
lines changed

en/chapter01-introduction.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/inst
7474

7575
We will be using Git a lot, and you should use it too not just for the purpose of this tutorial but for every single project.
7676

77-
* sous Mac OS: `$ brew install git`
78-
* sous Linux: `$ sudo apt-get install git`
77+
* on Mac OS: `$ brew install git`
78+
* on Linux: `$ sudo apt-get install git`
7979

8080
=== Ruby
8181

@@ -350,15 +350,15 @@ The next step is to ignore some files that we don’t want to track, so your `.g
350350
/config/master.key
351351
----
352352

353-
After modifiying the `.gitignore` file we just need to add the files and commit the changes, the commands necessary are shown below:
353+
After modifying the `.gitignore` file we just need to add the files and commit the changes, the commands necessary are shown below:
354354

355355
[source,bash]
356356
----
357357
$ git add .
358358
$ git commit -m "Initial commit"
359359
----
360360

361-
TIP: I have encounter that commiting with a message starting with a present tense verb, describes what the commit does and not what it did, this way when you are exploring the history of the project it is more natural to read and understand(or at least for me). I’ll follow this practice until the end of the tutorial.
361+
TIP: I have encounter that committing with a message starting with a present tense verb, describes what the commit does and not what it did, this way when you are exploring the history of the project it is more natural to read and understand(or at least for me). I’ll follow this practice until the end of the tutorial.
362362

363363
Lastly and as an optional step we setup the GitHub (I’m not going through that in here) project and push our code to the remote server: We first add the remote:
364364

en/chapter02-api.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Time to commit:
162162
[source,bash]
163163
----
164164
$ git add config/routes.rb
165-
$ git commit -m "Set the routes contraints for the api"
165+
$ git commit -m "Set the routes constraints for the api"
166166
----
167167

168168
All right take a deep breath, drink some water, and let’s get going.

en/chapter03-presenting-users.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ RSpec.describe Api::V1::UsersController, type: :controller do
594594
expect(user_response).to have_key(:errors)
595595
end
596596
597-
it "renders the json errors on whye the user could not be created" do
597+
it "renders the json errors on why the user could not be created" do
598598
user_response = JSON.parse(response.body, symbolize_names: true)
599599
expect(user_response[:errors][:email]).to include "is invalid"
600600
end

en/chapter04-refactoring-tests.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ RSpec.describe Api::V1::UsersController, type: :controller do
105105
expect(user_response).to have_key(:errors)
106106
end
107107
108-
it "renders the json errors on whye the user could not be created" do
108+
it "renders the json errors on why the user could not be created" do
109109
user_response = JSON.parse(response.body, symbolize_names: true)
110110
expect(user_response[:errors][:email]).to include "is invalid"
111111
end

en/chapter05-athentification.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ First things first (and as usual when starting a new chapter) we will create a n
1919
$ git checkout -b chapter5
2020
----
2121

22-
== Session sans état
22+
== Stateless session
2323

2424
Before we go any further, something must be clear: *an API does not handle sessions*. If you don’t have experience building these kind of applications it might sound a little crazy but stay with me. An API should be stateless which means by definition _is one that provides a response after your request, and then requires no further attention._. Which means no previous or future state is required for the system to work.
2525

en/chapter06-user-products.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ RSpec.describe Api::V1::ProductsController, type: :controller do
530530
expect(product_response).to have_key(:errors)
531531
end
532532
533-
it 'renders the json errors on whye the user could not be created' do
533+
it 'renders the json errors on why the user could not be created' do
534534
product_response = json_response
535535
expect(product_response[:errors][:price]).to include 'is not a number'
536536
end
@@ -671,7 +671,7 @@ RSpec.describe Api::V1::ProductsController, type: :controller do
671671
expect(product_response).to have_key(:errors)
672672
end
673673
674-
it 'renders the json errors on whye the user could not be created' do
674+
it 'renders the json errors on why the user could not be created' do
675675
product_response = json_response
676676
expect(product_response[:errors][:price]).to include 'is not a number'
677677
end
@@ -875,6 +875,6 @@ $ git commit -m "Updates test environment factory gems to work on development"
875875
876876
== Conclusion
877877
878-
On the next chapter we will focus on customizing the output from the `user` and `product` models using the active model serializers gem. It will help us to easily filter attributes to display (or handle associations as embebed objects for example).
878+
On the next chapter we will focus on customizing the output from the `user` and `product` models using the active model serializers gem. It will help us to easily filter attributes to display (or handle associations as embedded objects for example).
879879
880880
I hope you have enjoyed this chapter. It is a long one but the code we put together is an excellent base for the core app.

en/chapter07-improve-json.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ So we’ll be embedding the user object into the product. Let’s start by addin
247247
RSpec.describe Api::V1::ProductsController, type: :controller do
248248
describe 'GET #show' do
249249
# ...
250-
it 'has the user as a embeded object' do
250+
it 'has the user as a embedded object' do
251251
expect(json_response[:user][:email]).to eql @product.user.email
252252
end
253253
end
@@ -301,7 +301,7 @@ First we make sure the `product_ids` it is part of the user serialized object:
301301
RSpec.describe Api::V1::UsersController, type: :controller do
302302
describe 'GET #show' do
303303
# ...
304-
it 'has the product ids as an embeded object' do
304+
it 'has the product ids as an embedded object' do
305305
expect(json_response[:product_ids]).to eql []
306306
end
307307
end

en/chapter08-placing-orders.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ Finished in 1.82 seconds (files took 0.78532 seconds to load)
975975
98 examples, 0 failures
976976
----
977977

978-
Let’s finish this section by commiting this:
978+
Let’s finish this section by committing this:
979979

980980
[source,bash]
981981
----

en/chapter09-improve-orders.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Finished in 0.33759 seconds (files took 3.54 seconds to load)
125125
8 examples, 0 failures
126126
----
127127

128-
The `build_placements_with_product_ids_and_quantities` will build the placement objects and once we trigger the `save` method for the order everything will be inserted into the database. One last step before commiting this is to update the `orders_controller_spec` along with its implementation.
128+
The `build_placements_with_product_ids_and_quantities` will build the placement objects and once we trigger the `save` method for the order everything will be inserted into the database. One last step before committing this is to update the `orders_controller_spec` along with its implementation.
129129

130130
First we update the `orders_controller_spec` file:
131131

en/chapter10-optimization.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ As I have been telling you since the beginning of this book, an important and di
2929

3030
One of the most applied conventions is most certainly https://jsonapi.org/[JSON:API]. This convention will allow us to approach pagination more serenely in the next section.
3131

32-
So https://jsonapi.org/format/#document-structure[documentation de JSON:API] gives us some rules to follow concerning JSON presentation.
32+
So https://jsonapi.org/format/#document-structure[documentation JSON:API] gives us some rules to follow concerning JSON presentation.
3333

3434
So our *document* must follow theses rules:
3535

3636
* `data`: which must contains the data we send back
3737
* `errors` which must contains a table of errors that have occurred
38-
* `meta` which contains https://jsonapi.org/format/#document-meta[objet meta]
38+
* `meta` which contains https://jsonapi.org/format/#document-meta[object meta]
3939

4040
NOTE: The `data` and `errors` keys must not be present at the same time and this makes sense since if an error occurs we should not be able to make data correct.
4141

@@ -62,7 +62,7 @@ RSpec.describe Api::V1::UsersController, type: :controller do
6262
expect(json_response[:email]).to eql @user.email
6363
end
6464
65-
it 'has the product ids as an embeded object' do
65+
it 'has the product ids as an embedded object' do
6666
expect(json_response[:product_ids]).to eql []
6767
end
6868
end
@@ -83,7 +83,7 @@ RSpec.describe Api::V1::UsersController, type: :controller do
8383
expect(json_response[:data][:attributes][:email]).to eql @user.email
8484
end
8585
86-
it 'has the product ids as an embeded object' do
86+
it 'has the product ids as an embedded object' do
8787
expect(json_response[:data][:attributes][:'product-ids']).to eql []
8888
end
8989
end
@@ -154,7 +154,7 @@ RSpec.describe Api::V1::ProductsController, type: :controller do
154154
expect(json_response[:data][:attributes][:title]).to eql @product.title
155155
end
156156
157-
it 'has the user as a embeded object' do
157+
it 'has the user as a embedded object' do
158158
puts json_response.inspect
159159
expect(json_response[:data][:relationships][:user][:attributes][:email]).to eql @product.user.email
160160
end
@@ -228,7 +228,7 @@ RSpec.describe Api::V1::ProductsController, type: :controller do
228228
expect(json_response[:data][:attributes][:title]).to eql @product.title
229229
end
230230
231-
it 'has the user as a embeded object' do
231+
it 'has the user as a embedded object' do
232232
expect(json_response[:data][:relationships][:user][:attributes][:email]).to eql @product.user.email
233233
end
234234
end
@@ -270,7 +270,7 @@ RSpec.describe Api::V1::ProductsController, type: :controller do
270270
271271
context 'when is not created' do
272272
# ...
273-
it 'renders the json errors on whye the user could not be created' do
273+
it 'renders the json errors on why the user could not be created' do
274274
product_response = json_response
275275
expect(product_response[:errors][:price]).to include 'is not a number'
276276
end
@@ -344,7 +344,7 @@ $ rspec spec
344344
345345
Failures:
346346
347-
1) Api::V1::ProductsController GET #show has the user as a embeded object
347+
1) Api::V1::ProductsController GET #show has the user as a embedded object
348348
Failure/Error: expect(json_response[:data][:relationships][:user][:attributes][:email]).to eql @product.user.email
349349
...
350350
@@ -371,7 +371,7 @@ So let’s update our test:
371371
RSpec.describe Api::V1::ProductsController, type: :controller do
372372
describe 'GET #show' do
373373
# ...
374-
it 'has the user as a embeded object' do
374+
it 'has the user as a embedded object' do
375375
expect(json_response[:included].first[:attributes][:email]).to eql @product.user.email
376376
end
377377
end

0 commit comments

Comments
 (0)