diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-18 05:54:55 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-18 05:54:55 +0000 |
commit | 2e14dc59dbe239c915c074b69cfcea1605a360c0 (patch) | |
tree | 413aa7dbc8e6ff203b05a86966241ca7fcb0d92a | |
parent | d64b2cbb8d2ba74ad3e983b0005f3f8bb97ed6cb (diff) |
automatic import of python-refreshbooks
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-refreshbooks.spec | 357 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 359 insertions, 0 deletions
@@ -0,0 +1 @@ +/refreshbooks-2.0.tar.gz diff --git a/python-refreshbooks.spec b/python-refreshbooks.spec new file mode 100644 index 0000000..ca74f61 --- /dev/null +++ b/python-refreshbooks.spec @@ -0,0 +1,357 @@ +%global _empty_manifest_terminate_build 0 +Name: python-refreshbooks +Version: 2.0 +Release: 1 +Summary: A client library for the FreshBooks API +License: UNKNOWN +URL: http://github.com/freshbooks/refreshbooks +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ea/2d/bf57186bc4e0e6fc99c7744516e03b2864b546484f0d4b067a0d8e7d064a/refreshbooks-2.0.tar.gz +BuildArch: noarch + + +%description +Refreshbooks provides a simple synchronous API for manipulating FreshBooks +invoices, clients, and other data:: + + from refreshbooks import api + + c = api.OAuthClient( + 'example.freshbooks.com', + 'consumerkey', + 'My Consumer Secret', + 'An existing token', + 'An existing token secret', + user_agent='Example/1.0' + ) + + # XML structure inferred from args + response = c.invoice.create( # <request method="invoice.create"> + invoice=dict( # <invoice> + client_id='8', # <client_id>8</client_id> + lines=[ # <lines> + api.types.line( # <line> + name='Yard Work', # <name>Yard Work</name> + unit_cost='10', # <unit_cost>10</unit_cost> + quantity='4' # <quantity>4</quantity> + ) # </line> + ] # </lines> + ) # </invoice> + ) # </request> + + invoice_response = c.invoice.get( # <request method="invoice.get"> + invoice_id=response.invoice_id # <invoice_id>...</invoice_id> + ) # </request> + + print "New invoice created: #%s (id %s)" % ( + invoice_response.invoice.number, + invoice_response.invoice.invoice_id + ) + + invoices_response = c.invoice.list() # <request method="invoice.list" /> + + print "There are %s pages of invoices." % ( + invoices_response.invoices.attrib['pages'], + ) + + for invoice in invoices_response.invoices.invoice: + print "Invoice %s total: %s" % ( + invoice.invoice_id, + invoice.amount + ) + +Consumer keys and secrets can be obtained from FreshBooks. This library +does not handle negotiating for an OAuth token+secret pair; see the +`oauth` module or the OAuth specification for details. + +This library also supports the older token-based API authorization +scheme:: + + c = api.TokenClient( + 'example.freshbooks.com', + 'My API token', + user_agent='Example/1.0' + ) + + # ... as above ... + +API methods return lxml.objectify.ObjectifiedDataElement trees, which +can be manipulated as Python objects with the same structure as the +underlying XML. + +If you are having trouble accessing items as in: + + items_response = c.items.list() + for item in items_response.items.item: + print item.item_id + +Adjust your syntax to use dictionary item lookup: + + items_response = c.items.list() + for item in items_response['items'].item: + print item.item_id + +ObjectifiedDataElement provides a method named items which shadows the +items element in the response. Accessing items with dictionary lookup +syntax is the known work-around. + +To run tests: + + python setup.py nosetests + +To run network-accessing integration tests against httpstat.us: + + python setup.py nosetests --attr=integration + +References: + + - http://developers.freshbooks.com/ - The FreshBooks API + - http://developers.freshbooks.com/authentication-2/#OAuth - FreshBooks and OAuth + +%package -n python3-refreshbooks +Summary: A client library for the FreshBooks API +Provides: python-refreshbooks +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-refreshbooks +Refreshbooks provides a simple synchronous API for manipulating FreshBooks +invoices, clients, and other data:: + + from refreshbooks import api + + c = api.OAuthClient( + 'example.freshbooks.com', + 'consumerkey', + 'My Consumer Secret', + 'An existing token', + 'An existing token secret', + user_agent='Example/1.0' + ) + + # XML structure inferred from args + response = c.invoice.create( # <request method="invoice.create"> + invoice=dict( # <invoice> + client_id='8', # <client_id>8</client_id> + lines=[ # <lines> + api.types.line( # <line> + name='Yard Work', # <name>Yard Work</name> + unit_cost='10', # <unit_cost>10</unit_cost> + quantity='4' # <quantity>4</quantity> + ) # </line> + ] # </lines> + ) # </invoice> + ) # </request> + + invoice_response = c.invoice.get( # <request method="invoice.get"> + invoice_id=response.invoice_id # <invoice_id>...</invoice_id> + ) # </request> + + print "New invoice created: #%s (id %s)" % ( + invoice_response.invoice.number, + invoice_response.invoice.invoice_id + ) + + invoices_response = c.invoice.list() # <request method="invoice.list" /> + + print "There are %s pages of invoices." % ( + invoices_response.invoices.attrib['pages'], + ) + + for invoice in invoices_response.invoices.invoice: + print "Invoice %s total: %s" % ( + invoice.invoice_id, + invoice.amount + ) + +Consumer keys and secrets can be obtained from FreshBooks. This library +does not handle negotiating for an OAuth token+secret pair; see the +`oauth` module or the OAuth specification for details. + +This library also supports the older token-based API authorization +scheme:: + + c = api.TokenClient( + 'example.freshbooks.com', + 'My API token', + user_agent='Example/1.0' + ) + + # ... as above ... + +API methods return lxml.objectify.ObjectifiedDataElement trees, which +can be manipulated as Python objects with the same structure as the +underlying XML. + +If you are having trouble accessing items as in: + + items_response = c.items.list() + for item in items_response.items.item: + print item.item_id + +Adjust your syntax to use dictionary item lookup: + + items_response = c.items.list() + for item in items_response['items'].item: + print item.item_id + +ObjectifiedDataElement provides a method named items which shadows the +items element in the response. Accessing items with dictionary lookup +syntax is the known work-around. + +To run tests: + + python setup.py nosetests + +To run network-accessing integration tests against httpstat.us: + + python setup.py nosetests --attr=integration + +References: + + - http://developers.freshbooks.com/ - The FreshBooks API + - http://developers.freshbooks.com/authentication-2/#OAuth - FreshBooks and OAuth + +%package help +Summary: Development documents and examples for refreshbooks +Provides: python3-refreshbooks-doc +%description help +Refreshbooks provides a simple synchronous API for manipulating FreshBooks +invoices, clients, and other data:: + + from refreshbooks import api + + c = api.OAuthClient( + 'example.freshbooks.com', + 'consumerkey', + 'My Consumer Secret', + 'An existing token', + 'An existing token secret', + user_agent='Example/1.0' + ) + + # XML structure inferred from args + response = c.invoice.create( # <request method="invoice.create"> + invoice=dict( # <invoice> + client_id='8', # <client_id>8</client_id> + lines=[ # <lines> + api.types.line( # <line> + name='Yard Work', # <name>Yard Work</name> + unit_cost='10', # <unit_cost>10</unit_cost> + quantity='4' # <quantity>4</quantity> + ) # </line> + ] # </lines> + ) # </invoice> + ) # </request> + + invoice_response = c.invoice.get( # <request method="invoice.get"> + invoice_id=response.invoice_id # <invoice_id>...</invoice_id> + ) # </request> + + print "New invoice created: #%s (id %s)" % ( + invoice_response.invoice.number, + invoice_response.invoice.invoice_id + ) + + invoices_response = c.invoice.list() # <request method="invoice.list" /> + + print "There are %s pages of invoices." % ( + invoices_response.invoices.attrib['pages'], + ) + + for invoice in invoices_response.invoices.invoice: + print "Invoice %s total: %s" % ( + invoice.invoice_id, + invoice.amount + ) + +Consumer keys and secrets can be obtained from FreshBooks. This library +does not handle negotiating for an OAuth token+secret pair; see the +`oauth` module or the OAuth specification for details. + +This library also supports the older token-based API authorization +scheme:: + + c = api.TokenClient( + 'example.freshbooks.com', + 'My API token', + user_agent='Example/1.0' + ) + + # ... as above ... + +API methods return lxml.objectify.ObjectifiedDataElement trees, which +can be manipulated as Python objects with the same structure as the +underlying XML. + +If you are having trouble accessing items as in: + + items_response = c.items.list() + for item in items_response.items.item: + print item.item_id + +Adjust your syntax to use dictionary item lookup: + + items_response = c.items.list() + for item in items_response['items'].item: + print item.item_id + +ObjectifiedDataElement provides a method named items which shadows the +items element in the response. Accessing items with dictionary lookup +syntax is the known work-around. + +To run tests: + + python setup.py nosetests + +To run network-accessing integration tests against httpstat.us: + + python setup.py nosetests --attr=integration + +References: + + - http://developers.freshbooks.com/ - The FreshBooks API + - http://developers.freshbooks.com/authentication-2/#OAuth - FreshBooks and OAuth + +%prep +%autosetup -n refreshbooks-2.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-refreshbooks -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +042fd53a7b6e4335cbf7209336f077b9 refreshbooks-2.0.tar.gz |