Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Updated name scheme to match other CL's #1

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The Python client library for the Tuneup Technology App.
[![Build Status](https://travis-ci.com/ncr4/tuneuptechnology-python.svg?branch=master)](https://travis-ci.com/ncr4/tuneuptechnology-python)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)

This library allows you to interact with the customers, tickets, inventory, and locations objects without needing to do the hard work of binding your calls and data to endpoints. Simply call an action such as `create_customer` and pass some data and let the library do the rest.
This library allows you to interact with the customers, tickets, inventory, and locations objects without needing to do the hard work of binding your calls and data to endpoints. Simply call an action such as `Customer.create` and pass some data and let the library do the rest.

## Install

Expand All @@ -25,7 +25,7 @@ load_dotenv()
API_EMAIL = os.getenv('API_EMAIL')
API_KEY = os.getenv('API_KEY')

CUSTOMER = tuneuptechnology.Customers.create_customer(
CUSTOMER = tuneuptechnology.Customer.create(
data={
'auth': API_EMAIL,
'api_key': API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion examples/create_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
API_EMAIL = os.getenv('API_EMAIL')
API_KEY = os.getenv('API_KEY')

CUSTOMER = tuneuptechnology.Customers.create_customer(
CUSTOMER = tuneuptechnology.Customer.create(
data={
'auth': API_EMAIL,
'api_key': API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion examples/delete_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
API_KEY = os.getenv('API_KEY')

# Retrieve a single customer record
CUSTOMER = tuneuptechnology.Customers.delete_customer(
CUSTOMER = tuneuptechnology.Customer.delete(
data={
'auth': API_EMAIL,
'api_key': API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion examples/retrieve_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
API_EMAIL = os.getenv('API_EMAIL')
API_KEY = os.getenv('API_KEY')

CUSTOMER = tuneuptechnology.Customers.retrieve_customer(
CUSTOMER = tuneuptechnology.Customer.retrieve(
data={
'auth': API_EMAIL,
'api_key': API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion examples/retrieve_customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
API_EMAIL = os.getenv('API_EMAIL')
API_KEY = os.getenv('API_KEY')

CUSTOMERS = tuneuptechnology.Customers.retrieve_customers(
CUSTOMERS = tuneuptechnology.Customer.all(
data={
'auth': API_EMAIL,
'api_key': API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion examples/update_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
API_EMAIL = os.getenv('API_EMAIL')
API_KEY = os.getenv('API_KEY')

CUSTOMER = tuneuptechnology.Customers.update_customer(
CUSTOMER = tuneuptechnology.Customer.update(
data={
'auth': API_EMAIL,
'api_key': API_KEY,
Expand Down
8 changes: 4 additions & 4 deletions tuneuptechnology/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""The Tuneup Technology App Python Client Library"""
"""Import all files for the client library"""
from tuneuptechnology.client import Client
from tuneuptechnology.util import Util
from tuneuptechnology.customer import Customers
from tuneuptechnology.customer import Customer
from tuneuptechnology.inventory import Inventory
from tuneuptechnology.location import Locations
from tuneuptechnology.ticket import Tickets
from tuneuptechnology.location import Location
from tuneuptechnology.ticket import Ticket
12 changes: 6 additions & 6 deletions tuneuptechnology/customer.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
"""All Customer methods are housed here"""
from tuneuptechnology.client import Client

class Customers(Client):
class Customer(Client):
"""Customer methods"""
@classmethod
def create_customer(cls, data):
def create(cls, data):
"""Create a customer based on the data passed"""
endpoint = f'{Client.API_BASE_URL}customers/create'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_customers(cls, data):
def all(cls, data):
"""Retrieve all customers"""
endpoint = f'{Client.API_BASE_URL}customers'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_customer(cls, data):
def retrieve(cls, data):
"""Retrieve a single customer"""
endpoint = f'{Client.API_BASE_URL}customers/{data["id"]}'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def update_customer(cls, data):
def update(cls, data):
"""Update a customer with the passed params"""
endpoint = f'{Client.API_BASE_URL}customers/{data["id"]}/update'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def delete_customer(cls, data):
def delete(cls, data):
"""Delete a customer with the ID passed"""
endpoint = f'{Client.API_BASE_URL}customers/{data["id"]}/delete'
response = Client.response(data, endpoint)
Expand Down
10 changes: 5 additions & 5 deletions tuneuptechnology/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
class Inventory(Client):
"""Inventory methods"""
@classmethod
def create_inventory(cls, data):
def create(cls, data):
"""Create an inventory item based on the data passed"""
endpoint = f'{Client.API_BASE_URL}inventory/create'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_inventorys(cls, data):
def all(cls, data):
"""Retrieve all inventory"""
endpoint = f'{Client.API_BASE_URL}inventorys'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_inventory(cls, data):
def retrieve(cls, data):
"""Retrieve a single inventory item"""
endpoint = f'{Client.API_BASE_URL}inventory/{data["id"]}'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def update_inventory(cls, data):
def update(cls, data):
"""Update an inventory item with the passed params"""
endpoint = f'{Client.API_BASE_URL}inventory/{data["id"]}/update'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def delete_inventory(cls, data):
def delete(cls, data):
"""Delete an inventory item with the ID passed"""
endpoint = f'{Client.API_BASE_URL}inventory/{data["id"]}/delete'
response = Client.response(data, endpoint)
Expand Down
12 changes: 6 additions & 6 deletions tuneuptechnology/location.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
"""All Location methods are housed here"""
from tuneuptechnology.client import Client

class Locations(Client):
class Location(Client):
"""Location methods"""
@classmethod
def create_location(cls, data):
def create(cls, data):
"""Create a location based on the data passed"""
endpoint = f'{Client.API_BASE_URL}locations/create'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_locations(cls, data):
def all(cls, data):
"""Retrieve all locations"""
endpoint = f'{Client.API_BASE_URL}locations'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_location(cls, data):
def retrieve(cls, data):
"""Retrieve a single location"""
endpoint = f'{Client.API_BASE_URL}locations/{data["id"]}'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def update_location(cls, data):
def update(cls, data):
"""Update a location with the passed params"""
endpoint = f'{Client.API_BASE_URL}locations/{data["id"]}/update'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def delete_location(cls, data):
def delete(cls, data):
"""Delete a location with the ID passed"""
endpoint = f'{Client.API_BASE_URL}locations/{data["id"]}/delete'
response = Client.response(data, endpoint)
Expand Down
12 changes: 6 additions & 6 deletions tuneuptechnology/ticket.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
"""All Ticket methods are housed here"""
from tuneuptechnology.client import Client

class Tickets(Client):
class Ticket(Client):
"""Ticket methods"""
@classmethod
def create_ticket(cls, data):
def create(cls, data):
"""Create a ticket based on the data passed"""
endpoint = f'{Client.API_BASE_URL}tickets/create'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_tickets(cls, data):
def all(cls, data):
"""Retrieve all tickets"""
endpoint = f'{Client.API_BASE_URL}tickets'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def retrieve_ticket(cls, data):
def retrieve(cls, data):
"""Retrieve a single ticket"""
endpoint = f'{Client.API_BASE_URL}tickets/{data["id"]}'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def update_ticket(cls, data):
def update(cls, data):
"""Update a ticket with the passed params"""
endpoint = f'{Client.API_BASE_URL}tickets/{data["id"]}/update'
response = Client.response(data, endpoint)
return response.json()

@classmethod
def delete_ticket(cls, data):
def delete(cls, data):
"""Delete a ticket with the ID passed"""
endpoint = f'{Client.API_BASE_URL}tickets/{data["id"]}/delete'
response = Client.response(data, endpoint)
Expand Down