Skip to content

Commit

Permalink
Removed API_KEY from Examples. Added Pickup/Dropoff and Insert Locati…
Browse files Browse the repository at this point in the history
…ons Examples
  • Loading branch information
r4m-juan committed Apr 19, 2022
1 parent ef2f019 commit 4e2a8af
Show file tree
Hide file tree
Showing 118 changed files with 1,444 additions and 439 deletions.
12 changes: 8 additions & 4 deletions examples/activities/get_activities.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
route = route4me.route
print('Getting Last Route')
response = route.get_routes(limit=1, offset=0)
Expand Down Expand Up @@ -35,4 +35,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Activities')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
14 changes: 10 additions & 4 deletions examples/activity_feed/get_activities_feed.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-

# codebeat:disable[SIMILARITY]
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
activity_feed = route4me.activity_feed
response = activity_feed.get_activities_feed(limit=10, offset=0)
if isinstance(response, dict) and 'errors' in response.keys():
Expand All @@ -23,5 +24,10 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Activities Feed')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)

# codebeat:enable[SIMILARITY]
16 changes: 11 additions & 5 deletions examples/activity_feed/get_activities_feed_by_type.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

# codebeat:disable[SIMILARITY]
from route4me import Route4Me
import argparse

API_KEY = "11111111111111111111111111111111"
from route4me import Route4Me

ACTIVITY_TYPE = (
'delete-destination',
Expand Down Expand Up @@ -37,8 +37,9 @@
)


def main():
route4me = Route4Me(API_KEY)
def main(api_key):
route4me = Route4Me(api_key)

activity_feed = route4me.activity_feed
for activity_type in ACTIVITY_TYPE:
response = activity_feed.get_activities_feed_by_type(
Expand All @@ -62,5 +63,10 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Activities Feed by Type')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)

# codebeat:enable[SIMILARITY]
12 changes: 8 additions & 4 deletions examples/activity_feed/get_activity_feed_deleted.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
activity_feed = route4me.activity_feed
route = route4me.route
print('Getting Last Route')
Expand All @@ -30,4 +30,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Deleted Destination Activities')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
14 changes: 10 additions & 4 deletions examples/activity_feed/get_activity_feed_inserted.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-

# codebeat:disable[SIMILARITY]
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
activity_feed = route4me.activity_feed
route = route4me.route
print('Getting Last Route')
Expand All @@ -31,5 +32,10 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Inserted Destination Activities')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)

# codebeat:enable[SIMILARITY]
14 changes: 10 additions & 4 deletions examples/activity_feed/get_activity_feed_route_owner_changed.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-

# codebeat:disable[SIMILARITY]
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
activity_feed = route4me.activity_feed
route = route4me.route
print('Getting Last Route')
Expand All @@ -31,5 +32,10 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Route Owner Changed Activity')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)

# codebeat:enable[SIMILARITY]
13 changes: 9 additions & 4 deletions examples/activity_feed/log_specific_message.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-

import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
activity_feed = route4me.activity_feed
route = route4me.route
print('Getting Last Route')
Expand All @@ -27,4 +28,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Log Specific Message')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
13 changes: 9 additions & 4 deletions examples/addressbook/add_addressbook_contact.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-

import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
address_book = route4me.address_book
response = address_book.create_contact(
first_name="Juan",
Expand All @@ -22,4 +23,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Add AddressBook Contact')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
13 changes: 9 additions & 4 deletions examples/addressbook/delete_addressbook_contact.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-

import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
address_book = route4me.address_book
response = address_book.create_contact(
first_name="Juan",
Expand All @@ -33,4 +34,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Delete Address Book Contact')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
13 changes: 9 additions & 4 deletions examples/addressbook/get_addressbook_contact.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-

import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
address_book = route4me.address_book
response = address_book.get_addressbook_contacts(limit=10, offset=5)
if isinstance(response, dict) and 'errors' in response.keys():
Expand All @@ -27,4 +28,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Address Book Contact')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
13 changes: 9 additions & 4 deletions examples/addressbook/get_addressbook_contacts.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-

import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
address_book = route4me.address_book
response = address_book.get_addressbook_contacts(limit=10, Offset=5)
if 'errors' in response.keys():
Expand All @@ -22,4 +23,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Get Address Book Contacts')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
address_book = route4me.address_book
print('Searching "Juan" in Addressbook')
response = address_book.get_addressbook_contacts(
Expand All @@ -20,4 +20,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Search Contact by Field and Value')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
12 changes: 8 additions & 4 deletions examples/addressbook/update_addressbook_contact.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
address_book = route4me.address_book
response = address_book.get_addressbook_contacts(limit=10, offset=5)
if 'errors' in response.keys():
Expand All @@ -30,4 +30,8 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Update Address Book Contact')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)
14 changes: 10 additions & 4 deletions examples/addresses/add_address_to_optimization.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-

# codebeat:disable[LOC, ABC, BLOCK_NESTING]
import argparse

from route4me import Route4Me

API_KEY = "11111111111111111111111111111111"

def main(api_key):
route4me = Route4Me(api_key)

def main():
route4me = Route4Me(API_KEY)
optimization = route4me.optimization
response = optimization.get_optimizations(limit=10, offset=5)
if isinstance(response, dict) and 'errors' in response.keys():
Expand Down Expand Up @@ -69,5 +70,10 @@ def main():


if __name__ == '__main__':
main()
parser = argparse.ArgumentParser(description='Add address to Optimization')
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
type=str, required=True)
args = parser.parse_args()
main(args.api_key)

# codebeat:enable[LOC, ABC, BLOCK_NESTING]
Loading

0 comments on commit 4e2a8af

Please sign in to comment.