diff --git a/billingstack/samples.py b/billingstack/samples.py new file mode 100644 index 0000000..333d134 --- /dev/null +++ b/billingstack/samples.py @@ -0,0 +1,28 @@ +import glob +import os.path + +import anyjson as json + + +DIR = os.path.join(os.path.dirname(__file__), 'samples_data') + + +def get_sample(name): + """ + Get a sample file .json, for example user.json + + :param name: The name of the sample type + """ + f = open('%s/%s.json' % (DIR, name)) + return json.loads(f.read()) + + +def get_samples(): + """ + Read the samples and return it as a dict where the filename is the key + """ + samples = {} + for f in glob.glob(DIR + '/*.json'): + name = os.path.basename(f)[:-(len(".json"))] + samples[name] = get_sample(name) + return samples diff --git a/billingstack/samples_data/contact_info.json b/billingstack/samples_data/contact_info.json new file mode 100644 index 0000000..363ee25 --- /dev/null +++ b/billingstack/samples_data/contact_info.json @@ -0,0 +1,9 @@ +[ + { + "address1": "Superstreet 10", + "city": "SomeCity", + "state": "State X", + "country": "SomeCountry", + "company": "Company X" + } +] diff --git a/billingstack/samples_data/currency.json b/billingstack/samples_data/currency.json new file mode 100644 index 0000000..d34dec5 --- /dev/null +++ b/billingstack/samples_data/currency.json @@ -0,0 +1,8 @@ +[ + { + "letter": "nok" + }, + { + "letter": "sek" + } +] diff --git a/billingstack/samples_data/customer.json b/billingstack/samples_data/customer.json new file mode 100644 index 0000000..5e43d77 --- /dev/null +++ b/billingstack/samples_data/customer.json @@ -0,0 +1,5 @@ +[ + { + "name": "Customer X" + } +] diff --git a/billingstack/samples_data/language.json b/billingstack/samples_data/language.json new file mode 100644 index 0000000..33af14a --- /dev/null +++ b/billingstack/samples_data/language.json @@ -0,0 +1,8 @@ +[ + { + "letter": "nor" + }, + { + "letter": "swe" + } +] diff --git a/billingstack/samples_data/merchant.json b/billingstack/samples_data/merchant.json new file mode 100644 index 0000000..363ee25 --- /dev/null +++ b/billingstack/samples_data/merchant.json @@ -0,0 +1,9 @@ +[ + { + "address1": "Superstreet 10", + "city": "SomeCity", + "state": "State X", + "country": "SomeCountry", + "company": "Company X" + } +] diff --git a/billingstack/samples_data/user.json b/billingstack/samples_data/user.json new file mode 100644 index 0000000..cca156b --- /dev/null +++ b/billingstack/samples_data/user.json @@ -0,0 +1,6 @@ +[ + { + "username": "demo", + "password": "secret" + } +]