-
Notifications
You must be signed in to change notification settings - Fork 53
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
Creditcard docs #48
Merged
Merged
Creditcard docs #48
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\# Why `CreditCard.t`? If you read up on how to document Structs, you'll realise that `CreditCard`, (the module) should not be used as a "type" -- because it is a module, just a bunch of functions. This is related to the confusion between `String` and `String.t`. Composite types must be defined using @type. This helps static analysers like Dialyser to actually perform type-checking. \## Real World example In the excellent swoosh lib: https://github.com/swoosh/swoosh/search?utf8=%E2%9C%93&q=type+t+%3A%3A+%25__MODULE__%7Btype&type= References: https://www.reddit.com/r/elixir/comments/4v2ss2/help_me_understand_types_in_documentation_specs/ http://elixir-recipes.github.io/types/type-checking/ https://hexdocs.pm/elixir/typespecs.html#user-defined-types https://stackoverflow.com/questions/29977776/what-does-type-t-module-mean-in-elixir \# Other Note that `:year` and `:month` are **integers**!
Notice that the typespecs now show `Gringotts.CreditCard.t`, (which is clickable, unlike before!) instead of `Gringotts.CreditCard`
oyeb
added a commit
that referenced
this pull request
Dec 27, 2017
* I had missed a few `paymentId`s. * Since #48 is merged, we can use full_name(). Coverage increased for free :)
pkrawat1
pushed a commit
that referenced
this pull request
Dec 27, 2017
* Refactored code as suggested by credo Closes #27 * Grouped tests using describe * Better test descriptions Removed the pipes and spaces * Renamed ia CamelCase var. `paymentId` -> `payment_id` * Renamed missed CamelCase var, improves CC coverage * I had missed a few `paymentId`s. * Since #48 is merged, we can use full_name(). Coverage increased for free :) * Ran the elixir 1.6 formatter on Monei * Fixed unstore test description * Example cards will expire in 82 yrs :P
pkrawat1
pushed a commit
that referenced
this pull request
Dec 28, 2017
* Defines the CreditCard "type" and adds docs \# Why `CreditCard.t`? If you read up on how to document Structs, you'll realise that `CreditCard`, (the module) should not be used as a "type" -- because it is a module, just a bunch of functions. This is related to the confusion between `String` and `String.t`. Composite types must be defined using @type. This helps static analysers like Dialyser to actually perform type-checking. \## Real World example In the excellent swoosh lib: https://github.com/swoosh/swoosh/search?utf8=%E2%9C%93&q=type+t+%3A%3A+%25__MODULE__%7Btype&type= References: https://www.reddit.com/r/elixir/comments/4v2ss2/help_me_understand_types_in_documentation_specs/ http://elixir-recipes.github.io/types/type-checking/ https://hexdocs.pm/elixir/typespecs.html#user-defined-types https://stackoverflow.com/questions/29977776/what-does-type-t-module-mean-in-elixir \# Other Note that `:year` and `:month` are **integers**! * Changed @specs in all gateway docs (CreditCard.t) Notice that the typespecs now show `Gringotts.CreditCard.t`, (which is clickable, unlike before!) instead of `Gringotts.CreditCard`
pkrawat1
pushed a commit
that referenced
this pull request
Dec 28, 2017
* Refactored code as suggested by credo Closes #27 * Grouped tests using describe * Better test descriptions Removed the pipes and spaces * Renamed ia CamelCase var. `paymentId` -> `payment_id` * Renamed missed CamelCase var, improves CC coverage * I had missed a few `paymentId`s. * Since #48 is merged, we can use full_name(). Coverage increased for free :) * Ran the elixir 1.6 formatter on Monei * Fixed unstore test description * Example cards will expire in 82 yrs :P
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
CreditCard.t
?If you read up on how to document Structs, you'll realise that
CreditCard
, (the module) should not be used as a "type" -- because it is a module, just a bunch of functions. This is related to the confusion betweenString
andString.t
.Composite types must be defined using
@type
. This helps static analysers like Dialyser to actually perform type-checking.Real World example
In the excellent swoosh library.
References:
https://www.reddit.com/r/elixir/comments/4v2ss2/help_me_understand_types_in_documentation_specs/
http://elixir-recipes.github.io/types/type-checking/
https://hexdocs.pm/elixir/typespecs.html#user-defined-types
https://stackoverflow.com/questions/29977776/what-does-type-t-module-mean-in-elixir
Other
Notice that,
:year
and:month
are integers!Gringotts.CreditCard.t
, (which is clickable, unlike before!) instead ofGringotts.CreditCard