-
Notifications
You must be signed in to change notification settings - Fork 354
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
Basic list implementation #191
Conversation
@@ -44,6 +42,8 @@ defmodule Stripe.Converter do | |||
|
|||
# converts plain maps | |||
defp convert_value(value) when is_map(value), do: convert_map(value) | |||
# converts lists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a space above this.
A list is a general-purpose Stripe object which holds one or more | ||
other Stripe objects in it's "data" property. | ||
|
||
In its current iteration it simpl allows serializing into a properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply.
Work with Stripe list objects. | ||
|
||
A list is a general-purpose Stripe object which holds one or more | ||
other Stripe objects in it's "data" property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its
|
||
In future iterations, it should: | ||
* Support multiple types of objects in its collection | ||
* Support fetching the next set of objects (pagination) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This -
is preferable over *
@@ -0,0 +1,19 @@ | |||
defmodule Stripe.List do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the thinking behind not using just a map
instead of a struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly because we will want to be able to fetch more pages eventually. This will probably be a function of this struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, stripe considers it an object (it has an "object" : "list"
) property, unlike, for example, legal_entity
or dob
which do not have such properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think Stripe considering it an object is good justification.
da043a5
to
0a2f16e
Compare
0a2f16e
to
13d755b
Compare
Closes #188
This is a basic implementation of a list module. It allows us to serialize list objects.
It still lacks support of pagination and fetching the next page of objects if there are multiple, but that's more advanced and should probably be handled separately.
It should also support having lists whose elements are not all of the same type, but due to lack of supporting all stripe objects, I cannot find a use case that would work as a test.