Skip to content

support subscribers and scripts api #85

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions bigcommerce/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ def __init__(self, resource_class, api):
else:
self.resource_class = resource_class
self.connection = api.connection
self.update_api_version()


def update_api_version(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you test this function?

api_version = "v2"
if "api_version" in self.resource_class.__dict__.keys():
api_version = self.resource_class.api_version

if self.connection.store_hash:
self.connection.api_path = '/stores/{}/%s/{}' % api_version
else:
self.connection.api_path = '/api/%s/{}' % api_version

def __getattr__(self, item):
"""
Expand Down
2 changes: 2 additions & 0 deletions bigcommerce/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
from .tax_classes import *
from .time import *
from .webhooks import *
from .subscribers import *
from .scripts import *
8 changes: 8 additions & 0 deletions bigcommerce/resources/scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .base import *


class Scripts(ListableApiResource, CreateableApiResource,
UpdateableApiResource, DeleteableApiResource,
CollectionDeleteableApiResource, CountableApiResource):
resource_name = 'content/scripts'
api_version = 'v3'
8 changes: 8 additions & 0 deletions bigcommerce/resources/subscribers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .base import *


class Subscribers(ListableApiResource, CreateableApiResource,
UpdateableApiResource, DeleteableApiResource,
CollectionDeleteableApiResource, CountableApiResource):
resource_name = 'customers/subscribers'
api_version = 'v3'