@classmethod
def get_defaults(cls, shopify_resource):
    """
        Get a hash of attribute: values that can be used to update or create a local instance of the given Shopify
        resource.
        """
    defaults = {}
    for field in cls.get_default_fields():
        if hasattr(shopify_resource, field):
            defaults[field] = getattr(shopify_resource, field)
    for related_field in cls.get_related_field_names():
        if hasattr(shopify_resource, related_field):
            defaults[related_field + '_id'] = getattr(getattr(
                shopify_resource, related_field), 'id')
        related_field = related_field + '_id'
        if hasattr(shopify_resource, related_field):
            defaults[related_field] = getattr(shopify_resource, related_field)
    return defaults
