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

Basic list implementation #191

Merged
merged 1 commit into from
Jan 16, 2017
Merged

Basic list implementation #191

merged 1 commit into from
Jan 16, 2017

Conversation

begedin
Copy link
Contributor

@begedin begedin commented Jan 16, 2017

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.

@begedin begedin changed the base branch from master to 2.0 January 16, 2017 01:19
@@ -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
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@begedin begedin force-pushed the 188-basic-list-implementation branch 2 times, most recently from da043a5 to 0a2f16e Compare January 16, 2017 01:47
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 26.941% when pulling 0a2f16e on 188-basic-list-implementation into 9e74bd3 on 2.0.

@begedin begedin force-pushed the 188-basic-list-implementation branch from 0a2f16e to 13d755b Compare January 16, 2017 01:48
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 26.941% when pulling 13d755b on 188-basic-list-implementation into 9e74bd3 on 2.0.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 26.941% when pulling 13d755b on 188-basic-list-implementation into 9e74bd3 on 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants