siwapp-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +112 -0
- data/Rakefile +8 -0
- data/docs/DefaultApi.md +119 -0
- data/docs/Invoice.md +8 -0
- data/docs/InvoiceData.md +11 -0
- data/docs/InvoiceDataAttributes.md +13 -0
- data/docs/InvoiceDataMeta.md +8 -0
- data/docs/InvoiceDataRelationships.md +9 -0
- data/docs/InvoiceDataRelationshipsItems.md +8 -0
- data/docs/InvoiceDataRelationshipsPayments.md +8 -0
- data/docs/InvoiceItem.md +8 -0
- data/docs/InvoiceItemAttributes.md +12 -0
- data/docs/InvoicePayment.md +8 -0
- data/docs/InvoicePaymentAttributes.md +10 -0
- data/git_push.sh +55 -0
- data/lib/siwapp-client.rb +51 -0
- data/lib/siwapp-client/api/default_api.rb +139 -0
- data/lib/siwapp-client/api_client.rb +389 -0
- data/lib/siwapp-client/api_error.rb +38 -0
- data/lib/siwapp-client/configuration.rb +209 -0
- data/lib/siwapp-client/models/invoice.rb +188 -0
- data/lib/siwapp-client/models/invoice_data.rb +216 -0
- data/lib/siwapp-client/models/invoice_data_attributes.rb +249 -0
- data/lib/siwapp-client/models/invoice_data_meta.rb +189 -0
- data/lib/siwapp-client/models/invoice_data_relationships.rb +197 -0
- data/lib/siwapp-client/models/invoice_data_relationships_items.rb +190 -0
- data/lib/siwapp-client/models/invoice_data_relationships_payments.rb +190 -0
- data/lib/siwapp-client/models/invoice_item.rb +188 -0
- data/lib/siwapp-client/models/invoice_item_attributes.rb +236 -0
- data/lib/siwapp-client/models/invoice_payment.rb +188 -0
- data/lib/siwapp-client/models/invoice_payment_attributes.rb +209 -0
- data/lib/siwapp-client/version.rb +15 -0
- data/siwapp-client.gemspec +46 -0
- data/spec/api/default_api_spec.rb +60 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/invoice_data_attributes_spec.rb +72 -0
- data/spec/models/invoice_data_meta_spec.rb +42 -0
- data/spec/models/invoice_data_relationships_items_spec.rb +42 -0
- data/spec/models/invoice_data_relationships_payments_spec.rb +42 -0
- data/spec/models/invoice_data_relationships_spec.rb +48 -0
- data/spec/models/invoice_data_spec.rb +60 -0
- data/spec/models/invoice_item_attributes_spec.rb +66 -0
- data/spec/models/invoice_item_spec.rb +42 -0
- data/spec/models/invoice_payment_attributes_spec.rb +54 -0
- data/spec/models/invoice_payment_spec.rb +42 -0
- data/spec/models/invoice_spec.rb +42 -0
- data/spec/spec_helper.rb +111 -0
- metadata +281 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8888467300043fff4ae81a39dc2dc4ff8b2cb32d
|
4
|
+
data.tar.gz: 140fb1e8fd8bdbf2b6fce52ce6a07eb520c1585f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4285c800c96593de8bf00c8a4189b9562819d455e45a63a32f361febf6a89528fb0a14242d908812243f3f307697beaf1692fe18183fb4d354ac7bdee3698d4a
|
7
|
+
data.tar.gz: 1e6342a49c6202eabb03919e0c6569660d156f450accd74ac5e4aa73f3ef49929e02276d1fd5aeeccdafa90e013f9748717a3df9c2d1035cb65e7c72d8b6f2aa
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
# siwapp-client
|
2
|
+
|
3
|
+
SiwappClient - the Ruby gem for the Siwapp API Client
|
4
|
+
|
5
|
+
Access Siwapp data via API.
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
|
+
|
9
|
+
- API version: 1.0.0
|
10
|
+
- Package version: 1.0.0
|
11
|
+
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Build a gem
|
16
|
+
|
17
|
+
To build the Ruby code into a gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem build siwapp-client.gemspec
|
21
|
+
```
|
22
|
+
|
23
|
+
Then either install the gem locally:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
gem install ./siwapp-client-1.0.0.gem
|
27
|
+
```
|
28
|
+
(for development, run `gem install --dev ./siwapp-client-1.0.0.gem` to install the development dependencies)
|
29
|
+
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
|
+
|
32
|
+
Finally add this to the Gemfile:
|
33
|
+
|
34
|
+
gem 'siwapp-client', '~> 1.0.0'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO, then add the following in the Gemfile:
|
39
|
+
|
40
|
+
gem 'siwapp-client', :git => 'https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO.git'
|
41
|
+
|
42
|
+
### Include the Ruby code directly
|
43
|
+
|
44
|
+
Include the Ruby code directly using `-I` as follows:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
ruby -Ilib script.rb
|
48
|
+
```
|
49
|
+
|
50
|
+
## Getting Started
|
51
|
+
|
52
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
53
|
+
```ruby
|
54
|
+
# Load the gem
|
55
|
+
require 'siwapp-client'
|
56
|
+
|
57
|
+
# Setup authorization
|
58
|
+
SiwappClient.configure do |config|
|
59
|
+
# Configure API key authorization: Token
|
60
|
+
config.api_key['Authorization'] = 'YOUR API KEY'
|
61
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
62
|
+
#config.api_key_prefix['Authorization'] = 'Bearer'
|
63
|
+
end
|
64
|
+
|
65
|
+
api_instance = SiwappClient::DefaultApi.new
|
66
|
+
|
67
|
+
invoice = SiwappClient::Invoice.new # Invoice | Invoice.
|
68
|
+
|
69
|
+
|
70
|
+
begin
|
71
|
+
result = api_instance.create_invoice(invoice)
|
72
|
+
p result
|
73
|
+
rescue SiwappClient::ApiError => e
|
74
|
+
puts "Exception when calling DefaultApi->create_invoice: #{e}"
|
75
|
+
end
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
## Documentation for API Endpoints
|
80
|
+
|
81
|
+
All URIs are relative to *https://siwapp.ifni.sology.eu/api/v1*
|
82
|
+
|
83
|
+
Class | Method | HTTP request | Description
|
84
|
+
------------ | ------------- | ------------- | -------------
|
85
|
+
*SiwappClient::DefaultApi* | [**create_invoice**](docs/DefaultApi.md#create_invoice) | **POST** /invoices |
|
86
|
+
*SiwappClient::DefaultApi* | [**get_invoice_pdf**](docs/DefaultApi.md#get_invoice_pdf) | **GET** /invoices/print_template/{template_id}/invoice/{id}?format=pdf |
|
87
|
+
|
88
|
+
|
89
|
+
## Documentation for Models
|
90
|
+
|
91
|
+
- [SiwappClient::Invoice](docs/Invoice.md)
|
92
|
+
- [SiwappClient::InvoiceData](docs/InvoiceData.md)
|
93
|
+
- [SiwappClient::InvoiceDataAttributes](docs/InvoiceDataAttributes.md)
|
94
|
+
- [SiwappClient::InvoiceDataMeta](docs/InvoiceDataMeta.md)
|
95
|
+
- [SiwappClient::InvoiceDataRelationships](docs/InvoiceDataRelationships.md)
|
96
|
+
- [SiwappClient::InvoiceDataRelationshipsItems](docs/InvoiceDataRelationshipsItems.md)
|
97
|
+
- [SiwappClient::InvoiceDataRelationshipsPayments](docs/InvoiceDataRelationshipsPayments.md)
|
98
|
+
- [SiwappClient::InvoiceItem](docs/InvoiceItem.md)
|
99
|
+
- [SiwappClient::InvoiceItemAttributes](docs/InvoiceItemAttributes.md)
|
100
|
+
- [SiwappClient::InvoicePayment](docs/InvoicePayment.md)
|
101
|
+
- [SiwappClient::InvoicePaymentAttributes](docs/InvoicePaymentAttributes.md)
|
102
|
+
|
103
|
+
|
104
|
+
## Documentation for Authorization
|
105
|
+
|
106
|
+
|
107
|
+
### Token
|
108
|
+
|
109
|
+
- **Type**: API key
|
110
|
+
- **API key parameter name**: Authorization
|
111
|
+
- **Location**: HTTP header
|
112
|
+
|
data/Rakefile
ADDED
data/docs/DefaultApi.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# SiwappClient::DefaultApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://siwapp.ifni.sology.eu/api/v1*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**create_invoice**](DefaultApi.md#create_invoice) | **POST** /invoices |
|
8
|
+
[**get_invoice_pdf**](DefaultApi.md#get_invoice_pdf) | **GET** /invoices/print_template/{template_id}/invoice/{id}?format=pdf |
|
9
|
+
|
10
|
+
|
11
|
+
# **create_invoice**
|
12
|
+
> Invoice create_invoice(invoice)
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
Creating invoice.
|
17
|
+
|
18
|
+
### Example
|
19
|
+
```ruby
|
20
|
+
# load the gem
|
21
|
+
require 'siwapp-client'
|
22
|
+
# setup authorization
|
23
|
+
SiwappClient.configure do |config|
|
24
|
+
# Configure API key authorization: Token
|
25
|
+
config.api_key['Authorization'] = 'YOUR API KEY'
|
26
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
27
|
+
#config.api_key_prefix['Authorization'] = 'Bearer'
|
28
|
+
end
|
29
|
+
|
30
|
+
api_instance = SiwappClient::DefaultApi.new
|
31
|
+
|
32
|
+
invoice = SiwappClient::Invoice.new # Invoice | Invoice.
|
33
|
+
|
34
|
+
|
35
|
+
begin
|
36
|
+
result = api_instance.create_invoice(invoice)
|
37
|
+
p result
|
38
|
+
rescue SiwappClient::ApiError => e
|
39
|
+
puts "Exception when calling DefaultApi->create_invoice: #{e}"
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
### Parameters
|
44
|
+
|
45
|
+
Name | Type | Description | Notes
|
46
|
+
------------- | ------------- | ------------- | -------------
|
47
|
+
**invoice** | [**Invoice**](Invoice.md)| Invoice. |
|
48
|
+
|
49
|
+
### Return type
|
50
|
+
|
51
|
+
[**Invoice**](Invoice.md)
|
52
|
+
|
53
|
+
### Authorization
|
54
|
+
|
55
|
+
[Token](../README.md#Token)
|
56
|
+
|
57
|
+
### HTTP request headers
|
58
|
+
|
59
|
+
- **Content-Type**: application/json
|
60
|
+
- **Accept**: application/json
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
# **get_invoice_pdf**
|
65
|
+
> File get_invoice_pdf(template_id, id)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
Get invoice in pdf file.
|
70
|
+
|
71
|
+
### Example
|
72
|
+
```ruby
|
73
|
+
# load the gem
|
74
|
+
require 'siwapp-client'
|
75
|
+
# setup authorization
|
76
|
+
SiwappClient.configure do |config|
|
77
|
+
# Configure API key authorization: Token
|
78
|
+
config.api_key['Authorization'] = 'YOUR API KEY'
|
79
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
80
|
+
#config.api_key_prefix['Authorization'] = 'Bearer'
|
81
|
+
end
|
82
|
+
|
83
|
+
api_instance = SiwappClient::DefaultApi.new
|
84
|
+
|
85
|
+
template_id = 789 # Integer | ID of print template
|
86
|
+
|
87
|
+
id = 789 # Integer | ID of invoice
|
88
|
+
|
89
|
+
|
90
|
+
begin
|
91
|
+
result = api_instance.get_invoice_pdf(template_id, id)
|
92
|
+
p result
|
93
|
+
rescue SiwappClient::ApiError => e
|
94
|
+
puts "Exception when calling DefaultApi->get_invoice_pdf: #{e}"
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
### Parameters
|
99
|
+
|
100
|
+
Name | Type | Description | Notes
|
101
|
+
------------- | ------------- | ------------- | -------------
|
102
|
+
**template_id** | **Integer**| ID of print template |
|
103
|
+
**id** | **Integer**| ID of invoice |
|
104
|
+
|
105
|
+
### Return type
|
106
|
+
|
107
|
+
**File**
|
108
|
+
|
109
|
+
### Authorization
|
110
|
+
|
111
|
+
[Token](../README.md#Token)
|
112
|
+
|
113
|
+
### HTTP request headers
|
114
|
+
|
115
|
+
- **Content-Type**: application/json
|
116
|
+
- **Accept**: application/json
|
117
|
+
|
118
|
+
|
119
|
+
|
data/docs/Invoice.md
ADDED
data/docs/InvoiceData.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# SiwappClient::InvoiceData
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | Invoice ID. | [optional]
|
7
|
+
**attributes** | [**InvoiceDataAttributes**](InvoiceDataAttributes.md) | | [optional]
|
8
|
+
**meta** | [**InvoiceDataMeta**](InvoiceDataMeta.md) | | [optional]
|
9
|
+
**relationships** | [**InvoiceDataRelationships**](InvoiceDataRelationships.md) | | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# SiwappClient::InvoiceDataAttributes
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**name** | **String** | Customer's (company) name. |
|
7
|
+
**invoicing_address** | **String** | Customer's (company) invoicing address. | [optional]
|
8
|
+
**issue_date** | **String** | Invoice's issue date. Eg '2017-08-08' | [optional]
|
9
|
+
**series_id** | **Integer** | Series ID for numbering invoices (has to be set in Siwapp first). |
|
10
|
+
**currency** | **String** | Eg 'gbp' | [optional]
|
11
|
+
**status** | **String** | Inoice status. | [optional]
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# SiwappClient::InvoiceDataRelationships
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**items** | [**InvoiceDataRelationshipsItems**](InvoiceDataRelationshipsItems.md) | | [optional]
|
7
|
+
**payments** | [**InvoiceDataRelationshipsPayments**](InvoiceDataRelationshipsPayments.md) | | [optional]
|
8
|
+
|
9
|
+
|
data/docs/InvoiceItem.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# SiwappClient::InvoiceItemAttributes
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**description** | **String** | Items' description. | [optional]
|
7
|
+
**quantity** | **Integer** | Items' quantity. | [optional]
|
8
|
+
**discount** | **Integer** | Items' discount (eg 22 equals 22% discount). | [optional]
|
9
|
+
**tax_ids** | **Array<Integer>** | Array of tax ids (have to be already defined in Siwapp). |
|
10
|
+
**unitary_cost** | **Float** | Items' unitary cost. | [optional]
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# SiwappClient::InvoicePaymentAttributes
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**notes** | **String** | Payment's notes. | [optional]
|
7
|
+
**amount** | **Float** | Payment's amount. | [optional]
|
8
|
+
**date** | **String** | Payment's date eg '2017-02-03'. | [optional]
|
9
|
+
|
10
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
4
|
+
#
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
6
|
+
#
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
8
|
+
|
9
|
+
git_user_id=$1
|
10
|
+
git_repo_id=$2
|
11
|
+
release_note=$3
|
12
|
+
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
14
|
+
git_user_id=""
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
16
|
+
fi
|
17
|
+
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
19
|
+
git_repo_id=""
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ "$release_note" = "" ]; then
|
24
|
+
release_note=""
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
26
|
+
fi
|
27
|
+
|
28
|
+
# Initialize the local directory as a Git repository
|
29
|
+
git init
|
30
|
+
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
32
|
+
git add .
|
33
|
+
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
35
|
+
git commit -m "$release_note"
|
36
|
+
|
37
|
+
# Sets the new remote
|
38
|
+
git_remote=`git remote`
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
40
|
+
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
44
|
+
else
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
46
|
+
fi
|
47
|
+
|
48
|
+
fi
|
49
|
+
|
50
|
+
git pull origin master
|
51
|
+
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
55
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
=begin
|
2
|
+
#Siwapp API Client
|
3
|
+
|
4
|
+
#Access Siwapp data via API.
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'siwapp-client/api_client'
|
15
|
+
require 'siwapp-client/api_error'
|
16
|
+
require 'siwapp-client/version'
|
17
|
+
require 'siwapp-client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'siwapp-client/models/invoice'
|
21
|
+
require 'siwapp-client/models/invoice_data'
|
22
|
+
require 'siwapp-client/models/invoice_data_attributes'
|
23
|
+
require 'siwapp-client/models/invoice_data_meta'
|
24
|
+
require 'siwapp-client/models/invoice_data_relationships'
|
25
|
+
require 'siwapp-client/models/invoice_data_relationships_items'
|
26
|
+
require 'siwapp-client/models/invoice_data_relationships_payments'
|
27
|
+
require 'siwapp-client/models/invoice_item'
|
28
|
+
require 'siwapp-client/models/invoice_item_attributes'
|
29
|
+
require 'siwapp-client/models/invoice_payment'
|
30
|
+
require 'siwapp-client/models/invoice_payment_attributes'
|
31
|
+
|
32
|
+
# APIs
|
33
|
+
require 'siwapp-client/api/default_api'
|
34
|
+
|
35
|
+
module SiwappClient
|
36
|
+
class << self
|
37
|
+
# Customize default settings for the SDK using block.
|
38
|
+
# SiwappClient.configure do |config|
|
39
|
+
# config.username = "xxx"
|
40
|
+
# config.password = "xxx"
|
41
|
+
# end
|
42
|
+
# If no block given, return the default Configuration object.
|
43
|
+
def configure
|
44
|
+
if block_given?
|
45
|
+
yield(Configuration.default)
|
46
|
+
else
|
47
|
+
Configuration.default
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|