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

Validation QA and fix #102

Open
wants to merge 4 commits into
base: validation_review
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
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions plivo/resources/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def create(self,
region,
postal_code,
address_proof_type,
phone_number_country,
number_type,
alias=None,
file_to_upload=None,
auto_correct_address=None,
Expand Down Expand Up @@ -116,6 +118,8 @@ def create(self,
salutation=[all_of(of_type(six.text_type), is_in(('Mr', 'Ms')))],
first_name=[of_type(six.text_type)],
last_name=[of_type(six.text_type)],
phone_number_country=[of_type(six.text_type)],
number_type=[of_type(six.text_type)],
country_iso=[optional(of_type(six.text_type))],
address_line1=[optional(of_type(six.text_type))],
address_line2=[optional(of_type(six.text_type))],
Expand Down
31 changes: 19 additions & 12 deletions plivo/resources/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"""
Application class - along with its list class
"""

from plivo.base import (ListResponseObject, PlivoResource,
PlivoResourceInterface)
from plivo.base import (ListResponseObject,
PlivoResource,
PlivoResourceInterface
)
from plivo.resources.accounts import Subaccount
from plivo.utils import to_param_dict
from plivo.utils.validators import *
Expand Down Expand Up @@ -56,7 +57,8 @@ class Applications(PlivoResourceInterface):
default_number_app=[optional(of_type_exact(bool))],
default_endpoint_app=[optional(of_type_exact(bool))],
subaccount=[optional(is_subaccount())],
log_incoming_messages = [optional(of_type_exact(bool))])
log_incoming_messages = [optional(of_type_exact(bool))]
)
def create(self,
answer_url,
app_name,
Expand All @@ -76,13 +78,15 @@ def create(self,
if isinstance(subaccount, Subaccount):
subaccount = subaccount.id

return self.client.request('POST', ('Application', ),
to_param_dict(self.create, locals()))
return self.client.request(
'POST', ('Application', ), to_param_dict(self.create, locals())
)

@validate_args(app_id=[of_type(six.text_type)])
def get(self, app_id):
return self.client.request(
'GET', ('Application', app_id), response_type=Application)
'GET', ('Application', app_id), response_type=Application
)

@validate_args(
subaccount=[optional(is_subaccount())],
Expand Down Expand Up @@ -121,7 +125,8 @@ def list(self, subaccount=None, limit=20, offset=0):
default_number_app=[optional(of_type_exact(bool))],
default_endpoint_app=[optional(of_type_exact(bool))],
subaccount=[optional(is_subaccount())],
log_incoming_messages=[optional(of_type_exact(bool))])
log_incoming_messages=[optional(of_type_exact(bool))]
)
def update(self,
app_id,
answer_url,
Expand All @@ -139,10 +144,12 @@ def update(self,
if subaccount:
if isinstance(subaccount, Subaccount):
subaccount = subaccount.id
return self.client.request('POST', ('Application', app_id),
to_param_dict(self.update, locals()))
return self.client.request(
'POST', ('Application', app_id), to_param_dict(self.update, locals())
)

@validate_args(app_id=[of_type(six.text_type)])
def delete(self, app_id):
return self.client.request('DELETE', ('Application', app_id),
to_param_dict(self.update, locals()))
return self.client.request(
'DELETE', ('Application', app_id), to_param_dict(self.update, locals())
)
Loading