Skip to content

Commit 4b2dc8a

Browse files
authored
Update Docs (#28)
* Update README * Update Introduction * Update conf.py * Clean up conf.py * Pull version info from Versioneer * Update Docs to use RTD theme
1 parent 77b93c8 commit 4b2dc8a

File tree

3 files changed

+231
-250
lines changed

3 files changed

+231
-250
lines changed

README.rst

Lines changed: 76 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,18 @@
22
ciscosparkapi
33
=============
44

5-
-------------------------------------------------------------------------
6-
Simple, lightweight, scalable Python API wrapper for the Cisco Spark APIs
7-
-------------------------------------------------------------------------
5+
*Simple, lightweight, scalable Python API wrapper for the Cisco Spark APIs*
86

97
.. image:: https://img.shields.io/pypi/v/ciscosparkapi.svg
108
:target: https://pypi.python.org/pypi/ciscosparkapi
119
.. image:: https://readthedocs.org/projects/ciscosparkapi/badge/?version=latest
1210
:target: http://ciscosparkapi.readthedocs.io/en/latest/?badge=latest
1311

14-
**Important update!**
15-
Complete user documentation is now available on
16-
`ciscosparkapi.readthedocs.io`_ !
12+
-------------------------------------------------------------------------------
1713

18-
Please use the issues_ page to report any issues or feedback regarding the
19-
documentation.
20-
21-
22-
Introduction
23-
------------
24-
25-
Sure, working with the Cisco Spark APIs is easy (see `developer.ciscospark.com`_). They are RESTful, naturally structured, require only a simple Access Token for authentication, and the data is elegantly represented in intuitive JSON. What could be easier?
26-
27-
.. code-block:: python
28-
29-
import requests
30-
31-
URL = 'https://api.ciscospark.com/v1/messages'
32-
ACCESS_TOKEN = '<your_access_token>'
33-
ROOM_ID = '<room_id>'
34-
MESSAGE_TEXT = '<message_text>'
35-
36-
headers = {'Authorization': 'Bearer ' + ACCESS_TOKEN,
37-
'Content-type': 'application/json;charset=utf-8'}
38-
post_data = {'roomId': ROOM_ID,
39-
'text': MESSAGE_TEXT}
40-
response = requests.post(URL, json=post_data, headers=headers)
41-
if response.status_code == 200:
42-
# Great your message was posted!
43-
message_id = response.json['id']
44-
message_text = response.json['text']
45-
print("New message created, with ID:", message_id)
46-
print(message_text)
47-
else:
48-
# Oops something went wrong... Better do something about it.
49-
print(response.status_code, response.text)
50-
51-
Like I said, EASY. However, in use, the code can become rather repetitive...
52-
53-
- You have to setup the environment every time
54-
- You have to remember URLs and request arguments (or reference the docs)
55-
- You have to parse the returned JSON and setup variables to hold the attributes you need
56-
- When requesting lists of items, you have to deal with pagination_
57-
58-
59-
Enter **ciscosparkapi**, a simple API wrapper that wraps all of the Spark API calls and returned JSON objects within native Python objects and function calls.
60-
61-
With ciscosparkapi, the above Python code can be consolidated to the following:
62-
63-
.. code-block:: python
64-
65-
from ciscosparkapi import CiscoSparkAPI
66-
67-
api = CiscoSparkAPI()
68-
try:
69-
message = api.messages.create('<room_id>', text='<message_text>')
70-
print("New message created, with ID:", message.id)
71-
print(message.text)
72-
except SparkApiError as e:
73-
print(e)
74-
75-
The ciscosparkapi package handles all of this for you:
76-
77-
+ Reads your Spark access token from a ``SPARK_ACCESS_TOKEN`` environment variable
78-
+ Wraps and represents all Spark API calls as a simple hierarchical tree of native-Python methods (with default arguments provided everywhere possible!)
79-
+ If your Python IDE supports **auto-completion** (like PyCharm_), you can navigate the available methods and object attributes right within your IDE
80-
+ Represents all returned JSON objects as native Python objects - you can access all of the object's attributes using native *dot.syntax*
81-
+ **Automatic and Transparent Pagination!** When requesting 'lists of objects' from Spark, requests for additional pages of responses are efficiently and automatically requested as needed
82-
+ Multipart encoding and uploading of local files, when creating messages with local file attachments
83-
84-
All of this, combined, lets you do powerful things simply:
14+
**ciscosparkapi** is a *community developed* Pythonic wrapping of the Cisco
15+
Spark APIs, which makes working with Cisco Spark in Python a *native* and
16+
*natural* experience!
8517

8618
.. code-block:: python
8719
@@ -109,14 +41,49 @@ All of this, combined, lets you do powerful things simply:
10941
api.messages.create(demo_room.id, text="Welcome to the room!",
11042
files=["https://developer.ciscospark.com/images/[email protected]"])
11143
112-
That's more than six Spark API calls in less than 23 lines of script code (with comments)!
113-
...and likely more than that depending on how many rooms are returned by Spark (remember pagination is handled for you automatically)
44+
45+
That's more than 6 Spark API calls in less than 23 lines of code (with comments
46+
and whitespace), and likely more than that since ciscosparkapi handles
47+
pagination_ for you automatically!
48+
49+
ciscosparkapi makes your life better... `Learn how!`__
50+
51+
__ Introduction_
52+
53+
54+
Features
55+
--------
56+
57+
ciscosparkapi does all of this for you...
58+
59+
+ Transparently sources your Spark credentials from your local environment
60+
61+
+ Provides and uses default arguments and settings everywhere possible, so you
62+
don't have to think about things like API endpoint URLs, HTTP headers and
63+
JSON formats
64+
65+
+ Represents all Cisco Spark API interactions using native Python tools
66+
67+
+ Authentication and Connection to the Cisco Spark Cloud ==>
68+
**CiscoSparkAPI** 'Connection Object'
69+
70+
+ API Calls ==> Hierarchically organized method calls underneath a
71+
**CiscoSparkAPI** 'Connection Object'
72+
73+
+ Returned Data Objects ==> Native Python objects
74+
75+
+ **Automatic and transparent pagination!**
76+
77+
+ Multipart encoding and uploading of local files
78+
79+
+ Auto-completion in your favorite IDE, descriptive exceptions, and so much
80+
more...
11481

11582

11683
Installation
11784
------------
11885

119-
Installation and updating of ciscosparkapi is easy:
86+
Installing and upgrading ciscosparkapi is easy:
12087

12188
**Install via PIP**
12289

@@ -131,85 +98,76 @@ Installation and updating of ciscosparkapi is easy:
13198
$ pip install ciscosparkapi --upgrade
13299
133100
134-
Releases & Release Notes
135-
------------------------
136-
137-
Complete and usable *Beta* releases_ have been published for this package.
101+
Documentation
102+
-------------
138103

139-
While the package APIs may change (while the package is in beta), the package capabilities should all be functional. If you experience any issues using this package, please report them using the issues_ log.
104+
**Excellent documentation is now available at:**
105+
http://ciscosparkapi.readthedocs.io
140106

141-
Please see the releases_ page for release notes on the incremental functionality and bug fixes that have been incorporated into the published releases.
107+
Check out the Quickstart_ to dive in and begin using ciscosparkapi.
142108

143109

144110
Examples
145111
--------
146112

147113
Looking for some examples or sample scripts? Check out the examples_ folder!
148114

149-
Have a good example script you would like to share? Please feel free to contribute!
150-
151-
152-
Documentation
153-
-------------
115+
Have a good example script you would like to share? Please feel free to
116+
`contribute`__!
154117

155-
**Complete user documentation is now available!**
118+
__ Contribution_
156119

157-
Read the Docs at `ciscosparkapi.readthedocs.io`_ !!
158120

159-
All of the user-facing methods have complete docstrings. You can view the docstrings for any method either from the `source files`_, or by using the Python ``help()`` function.
121+
Release Notes
122+
-------------
160123

161-
.. code-block:: python
124+
Complete and fully functional *Beta* releases have been published. Please
125+
see the releases_ page for release notes on the incremental functionality and
126+
bug fixes incorporated into the published releases.
162127

163-
>>> from ciscosparkapi import CiscoSparkAPI
164-
>>> api = CiscoSparkAPI()
165-
>>> help(api.messages.create)
166-
create(self, roomId=None, toPersonId=None, toPersonEmail=None, text=None, markdown=None, files=None) method of ciscosparkapi.api.messages.MessagesAPI instance
167-
Posts a message to a room.
128+
**Note:** The package APIs may change, while the package is in beta.
168129

169-
Posts a message, and optionally, a media content attachment, to a room.
170130

171-
You must specify either a roomId, toPersonId or toPersonEmail when
172-
posting a message, and you must supply some message content (text,
173-
markdown, files).
131+
Support
132+
-------
174133

175-
Args:
176-
roomId(string_types): The room ID.
177-
toPersonId(string_types): The ID of the recipient when sending a
178-
private 1:1 message.
179-
...
134+
This is a *community developed* and *community supported* project. If you
135+
experience any issues using this package, please report them using the
136+
issues_ log.
180137

181138

182139
Contribution
183140
------------
184141

185-
ciscosparkapi_ and it's sister project ciscosparksdk_ are community development projects. Feedback, thoughts, ideas and code contributions are most welcome!
142+
ciscosparkapi_ and it's sister project ciscosparksdk_ are community
143+
development projects. Feedback, thoughts, ideas and code contributions are
144+
most welcome!
186145

187-
To contribute to ciscosparkapi please use the following resources:
146+
**Feedback, issues, thoughts and ideas...**
188147

189-
Feedback, issues, thoughts and ideas... Please use the issues_ log.
148+
Please use the issues_ log.
190149

191-
Interested in contributing code?
150+
**Interested in contributing code?**
192151

193-
#. Check for open issues_ or create a new one.
152+
#. Check for open issues_ or create a new 'issue' for the item you want
153+
to work on.
194154

195-
* Assign yourself to the issue you want to work on, and communicate with any others that may be working the issue.
196-
* Project workflow is being managed via the GitHub projects_ feature. Move your issue to the 'In Progress' column of the project being worked.
155+
* Assign yourself to the issue, and communicate with any others that may be
156+
working the issue.
197157

198158
#. Review the project charter_ for coding standards and practices.
199159
#. Fork a copy of `the repository`_.
200160
#. Add your code to your forked repository.
201-
#. Submit a `pull request`_, and move your issue to the 'Code Review' column on the projects_ page.
161+
#. Submit a `pull request`_.
202162

203163

204164
*Copyright (c) 2016 Cisco Systems, Inc.*
205165

206-
207-
.. _developer.ciscospark.com: https://developer.ciscospark.com
166+
.. _Introduction: http://ciscosparkapi.readthedocs.io/en/latest/user/intro.html
208167
.. _pagination: https://developer.ciscospark.com/pagination.html
209-
.. _PyCharm: https://www.jetbrains.com/pycharm/
210-
.. _examples: https://github.com/CiscoDevNet/ciscosparkapi/tree/master/examples
211-
.. _source files: https://github.com/CiscoDevNet/ciscosparkapi/tree/master/ciscosparkapi
212168
.. _ciscosparkapi.readthedocs.io: https://ciscosparkapi.readthedocs.io
169+
.. _Quickstart: http://ciscosparkapi.readthedocs.io/en/latest/user/quickstart.html
170+
.. _examples: https://github.com/CiscoDevNet/ciscosparkapi/tree/master/examples
213171
.. _ciscosparkapi: https://github.com/CiscoDevNet/ciscosparkapi
214172
.. _ciscosparksdk: https://github.com/CiscoDevNet/ciscosparksdk
215173
.. _issues: https://github.com/CiscoDevNet/ciscosparkapi/issues

0 commit comments

Comments
 (0)