Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queues - AnnaElisabeth and Janice - VideoStoreAPI #15

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e69aa63
created a rails app api
annaewolf May 9, 2017
43317ac
pseudocoded routes
annaewolf May 9, 2017
60c3768
added ZOMG route
annaewolf May 9, 2017
b6dc894
created models and migrations
J-C-L May 9, 2017
f27628f
added relationships to models
J-C-L May 9, 2017
2256df2
added validation to rental model
J-C-L May 9, 2017
9a6235b
created customers controller
J-C-L May 9, 2017
eef84ab
added controller index method and tests
annaewolf May 9, 2017
95a57de
wrote movies index action and associated tests
J-C-L May 9, 2017
5d21bec
resolved conflict
J-C-L May 9, 2017
cf9d43e
added fixtures
annaewolf May 9, 2017
b1671b2
gave fixtures titles
annaewolf May 9, 2017
7ae6318
fixed fixture
annaewolf May 9, 2017
1786d2b
created rental yml entries
J-C-L May 9, 2017
9b7b69c
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
J-C-L May 9, 2017
da83423
wrote tests for movie model relationships
J-C-L May 9, 2017
8d94482
wrote customer model tests
annaewolf May 9, 2017
70abd0e
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
annaewolf May 9, 2017
16e1fcf
created tests for rental model validations and relationships
J-C-L May 10, 2017
3d4832c
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
J-C-L May 10, 2017
9a47d9f
added serializer
annaewolf May 10, 2017
224eac7
wrote show method to find movie by title
J-C-L May 10, 2017
12b776f
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
J-C-L May 10, 2017
e022251
resolved comflict
J-C-L May 10, 2017
2678d78
updates movies yml file
J-C-L May 10, 2017
918b38a
updated show method now that serializer is in effect
J-C-L May 10, 2017
3044a62
added capitalize to params
annaewolf May 10, 2017
136b82e
added create method for rental
annaewolf May 10, 2017
4c0f9c5
wrote checkin method for checking in rentals
J-C-L May 10, 2017
c8a1583
added model method
annaewolf May 10, 2017
a42abfb
just pulled
J-C-L May 10, 2017
54b8ef8
added tests
annaewolf May 10, 2017
f6e3e9a
wrote overdue method in rentals model and controller
J-C-L May 10, 2017
754abee
wrote test for checked_out customer model method
J-C-L May 10, 2017
bc72951
added fields
annaewolf May 10, 2017
72ab758
wrote test for overdue method in rental model
J-C-L May 10, 2017
baccf0b
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
annaewolf May 11, 2017
cb1193a
added rental serializer
annaewolf May 11, 2017
73c898c
started tests for checkin method
J-C-L May 11, 2017
7ce5ae7
wrote tests
annaewolf May 11, 2017
c00e435
merged
annaewolf May 11, 2017
fddce8f
added simplecov
J-C-L May 12, 2017
b4d58a0
finished testing checkin method and corrected movies show method, so …
J-C-L May 12, 2017
e1092bf
wrote tests for overdue method in rentals controller
J-C-L May 12, 2017
eb8b10a
simplecov is 100%
J-C-L May 12, 2017
9a4fa30
fixed a name for a smoke test
annaewolf May 12, 2017
5d25740
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
annaewolf May 12, 2017
15f4a57
changed tests to match new method name, movies_checked_out_count
J-C-L May 12, 2017
99fd997
added sort params
annaewolf May 12, 2017
b29a41a
changed tests + route so that smoke tests pass
annaewolf May 12, 2017
0c1ace8
...
J-C-L May 12, 2017
3225eba
added 2 rentals in seeds
J-C-L May 12, 2017
e930b0f
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
J-C-L May 12, 2017
1b2bdc7
added sort method to movies controller
annaewolf May 12, 2017
b9d6606
Merge branch 'master' of https://github.com/J-C-L/VideoStoreAPI
annaewolf May 12, 2017
317b2be
changed rental seeds to not conflict with smoke tests
J-C-L May 12, 2017
a905872
wrote method to sort overdue rentals by diff characteristics
J-C-L May 12, 2017
1f94ac5
added rentals tests
annaewolf May 12, 2017
0a98009
merged
annaewolf May 12, 2017
7d14d60
finished tests
annaewolf May 12, 2017
ebd197a
added pagination to customers index
J-C-L May 12, 2017
5f34074
fixed sorted overdue methods and tests
J-C-L May 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added rental serializer
annaewolf committed May 11, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit cb1193ad746e153b0fe04a74b3323e2cf53c3aab
7 changes: 4 additions & 3 deletions app/models/rental.rb
Original file line number Diff line number Diff line change
@@ -9,8 +9,9 @@ def self.overdue
self.all.select {|rental| (rental.checked_out == true) && (rental.due_date.past?)}
end

def checkout_date
self.created_at.strftime("%Y-%m-%m")
end

# def title
#
# end

end
20 changes: 17 additions & 3 deletions app/serializers/rental_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
class RentalSerializer < ActiveModel::Serializer
attributes :customer_id, :due_date, :checkout_date
has_one :movie
has_one :customer, only: [:postal_code]
attributes :title, :customer_id, :name, :postal_code, :due_date, :checkout_date


def title
object.movie.title
end

def name
object.customer.name
end

def postal_code
object.customer.postal_code
end

def checkout_date
object.created_at.strftime("%Y-%m-%d")
end
end