tsubaiso-sdk 1.0.0 → 1.1.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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +22 -326
  3. data/lib/tsubaiso_sdk.rb +599 -47
  4. data/test/test_tsubaiso_sdk.rb +731 -48
  5. metadata +31 -26
  6. data/README-j.md +0 -347
metadata CHANGED
@@ -1,83 +1,88 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsubaiso-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tsubaiso, Inc.
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '1.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.8.3
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.8'
30
+ - - ">="
28
31
  - !ruby/object:Gem::Version
29
- version: '0'
32
+ version: 1.8.3
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: minitest
32
35
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
36
  requirements:
35
- - - ! '>='
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5.4'
40
+ - - ">="
36
41
  - !ruby/object:Gem::Version
37
- version: '0'
42
+ version: 5.4.3
38
43
  type: :development
39
44
  prerelease: false
40
45
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
46
  requirements:
43
- - - ! '>='
47
+ - - "~>"
44
48
  - !ruby/object:Gem::Version
45
- version: '0'
49
+ version: '5.4'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 5.4.3
46
53
  description: A library of methods that directly uses Tsubaiso API web endpoints.
47
54
  email: apisupport@tsubaiso.net
48
55
  executables: []
49
56
  extensions: []
50
57
  extra_rdoc_files: []
51
58
  files:
52
- - lib/tsubaiso_sdk.rb
53
- - test/test_tsubaiso_sdk.rb
59
+ - README.md
54
60
  - Rakefile
61
+ - lib/tsubaiso_sdk.rb
55
62
  - sample.rb
56
- - README.md
57
- - README-j.md
63
+ - test/test_tsubaiso_sdk.rb
58
64
  homepage: https://github.com/tsubaiso/tsubaiso-sdk-ruby
59
65
  licenses:
60
66
  - MIT
67
+ metadata: {}
61
68
  post_install_message:
62
69
  rdoc_options: []
63
70
  require_paths:
64
71
  - lib
65
72
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
73
  requirements:
68
- - - ! '>='
74
+ - - ">="
69
75
  - !ruby/object:Gem::Version
70
- version: '0'
76
+ version: 1.9.3
71
77
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
78
  requirements:
74
- - - ! '>='
79
+ - - ">="
75
80
  - !ruby/object:Gem::Version
76
81
  version: '0'
77
82
  requirements: []
78
83
  rubyforge_project:
79
- rubygems_version: 1.8.23
84
+ rubygems_version: 2.4.8
80
85
  signing_key:
81
- specification_version: 3
86
+ specification_version: 4
82
87
  summary: SDK for the Tsubaiso API
83
88
  test_files: []
data/README-j.md DELETED
@@ -1,347 +0,0 @@
1
- # Tsubaiso API (beta)
2
-
3
- このドキュメントでは Tsubaiso API のベータ版の説明をします。
4
- Tsubaiso API ベータ版では売上明細と仕入・経費明細のデータをやりとりできます。
5
- 将来のバージョンでは、ツバイソシステムの他のモジュールにアクセスするための新しいエンドポイントが加わる予定です。
6
-
7
- ## Root Endpoint
8
-
9
- ```sh
10
- https://tsubaiso.net
11
- ```
12
-
13
- ## リクエストのフォーマット
14
-
15
- API へのすべてのリクエストは JSON を使って行います。
16
-
17
- ## 認証
18
-
19
- Tsubaiso API にアクセスするためには、アクセストークンを取得する必要があります。
20
- 以下は、アクセストークンを使って売上明細一覧のデータを取得する例です。
21
-
22
- ```
23
- $ curl -i -H "Access-Token: xxxxxxxxxxxxxxxxx" -H "Accept: application/json" -H "Content-Type: application/json" https://tsubaiso.net/ar/list
24
- ```
25
-
26
- ## レスポンスコードとエラー処理
27
-
28
- Code | Description
29
- --- | ---
30
- `200 OK` | リクエスト成功 |
31
- `204 No Content` | リクエストに成功したが返されるコンテンツはありません。
32
- `401 Not Authorized` | アクセストークンが送られていないか正しくありません。
33
- `403 Forbidden` | そのリクエストに必要な権限がありません。
34
- `404 Not found` | 指定されたパスは正しくないか、リソースが見つかりません。
35
- `422 Unprocessable Entity` | 1つ以上のパラメータが正しくないか不足しています。エラーメッセージで原因が判別できます。
36
- `500 Internal Server Error` | サーバーで何らかのエラーが起こりました。
37
- `503 Service Unavailable` | あなたの IP アドレスから非常に多くのリクエストがあった場合、このエラーが発生します。次のリクエストまで少し時間を開けてください。
38
-
39
- ## リソース
40
-
41
- #### 売上明細
42
-
43
- **/ar/list/:year/:month**
44
-
45
- 説明: このエンドポイントは特定の年月の売上明細の一覧を返します。年月パラメータが指定されなかった場合、現在の月の明細が返されます。
46
-
47
- HTTP メソッド: GET
48
-
49
- URL 構成例:
50
- ```sh
51
- https://tsubaiso.net/ar/list/2015/10
52
- ```
53
-
54
- JSON レスポンスの例:
55
- ```
56
- [
57
- {
58
- "ar_reason_master_id": 0,
59
- "ar_receipt_attachments_count": null,
60
- "code": null,
61
- "created_at": "2015/10/05 15:26:43 +0900",
62
- "customer_master_id": 101,
63
- "dc": "d",
64
- "dept_code": "DEPT A",
65
- "id": 8833,
66
- "memo": "500 widgets",
67
- "realization_timestamp": "2015/10/31 00:00:00 +0900",
68
- "regist_user_code": "sample_user",
69
- "sales_journal_dc_id": 6832,
70
- "scheduled_memo": null,
71
- "scheduled_receive_timestamp": null,
72
- "update_user_code": null,
73
- "updated_at": "2015/10/05 15:26:43 +0900",
74
- "account_code": "501",
75
- "sales_price": 5000,
76
- "sales_tax": 400,
77
- "sales_tax_type": 18
78
- }, {
79
- "ar_reason_master_id": 121278,
80
- "ar_receipt_attachments_count": null,
81
- "code": null,
82
- "created_at": "2015/10/05 17:39:34 +0900",
83
- "customer_master_id": 895820,
84
- "dc": "d",
85
- "dept_code": "DEPT B",
86
- "id": 8834,
87
- "memo": "100 clocks",
88
- "realization_timestamp": "2015/10/31 00:00:00 +0900",
89
- "regist_user_code": "sample_user",
90
- "sales_journal_dc_id": 8834,
91
- "scheduled_memo": null,
92
- "scheduled_receive_timestamp": null,
93
- "update_user_code": null,
94
- "updated_at": "2015/10/05 17:39:34 +0900",
95
- "account_code": "500",
96
- "sales_price": 10000,
97
- "sales_tax": 800,
98
- "sales_tax_type": 0
99
- }
100
- ]
101
- ```
102
-
103
- **/ar/show/:id**
104
-
105
- 説明: このエンドポイントは単一の売上明細を返します。
106
-
107
- HTTP メソッド: GET
108
-
109
- URL 構成例:
110
- ``` sh
111
- https://tsubaiso.net/ar/show/8833
112
- ```
113
-
114
- JSON レスポンスの例:
115
- ```
116
- {
117
- "ar_reason_master_id": 0,
118
- "ar_receipt_attachments_count": null,
119
- "code": null,
120
- "created_at": "2015/10/05 15:26:43 +0900",
121
- "customer_master_id": 101,
122
- "dc": "d",
123
- "dept_code": "DEPT A",
124
- "id": 8833,
125
- "memo": "500 widgets",
126
- "realization_timestamp": "2015/10/31 00:00:00 +0900",
127
- "regist_user_code": "sample_user",
128
- "sales_journal_dc_id": 6832,
129
- "scheduled_memo": null,
130
- "scheduled_receive_timestamp": null,
131
- "update_user_code": null,
132
- "updated_at": "2015/10/05 15:26:43 +0900",
133
- "account_code": "501",
134
- "sales_price": 5000,
135
- "sales_tax": 400,
136
- "sales_tax_type": 18
137
- }
138
- ```
139
-
140
- **/ar/create**
141
-
142
- 説明: 売上明細を新規作成します。作成に成功した場合、新規作成された明細が JSON として返されます。
143
-
144
- HTTP メソッド: POST
145
-
146
- URL 構成例:
147
- ```sh
148
- https://tsubaiso.net/ar/create
149
- ```
150
-
151
- Parameters:
152
-
153
- Parameter | Necessity | Type | Description
154
- --- | --- | --- | ---
155
- `price` | *required* | Integer | 売上高(税込)
156
- `realization_timestamp` | *required* | String | 明細の実現日。 "YYYY-MM-DD" 形式
157
- `customer_master_code` | *required* | String | 取引先コード
158
- `reason_master_code` | *required* | String | 明細の原因コード。仕訳を作成するために使われます。
159
- `dc` | *required* | String | 原因区分。 'd' は debit の意で「増加」に、'c' は credit の意で「減少」になります。
160
- `memo` | *required* | String | メモ。値は空文字でも構いませんが必須項目です。
161
- `tax_code` | *required* | Integer | 税区分コード
162
- `year` | *optional* | Integer | 年
163
- `month` | *optional* | Integer | 月
164
- `dept_code` | *optional* | String | 部門コード
165
- `sales_tax` | *optional* | Integer | 消費税額。指定されなかった場合、自動で計算されます。
166
- `scheduled_receipt_timestamp` | *optional* | String | 入金予定日。 “YYYY-MM-DD”形式
167
- `scheduled_memo` | *optional* | String | 入金予定に関するメモ
168
-
169
- リクエストの例:
170
- ```sh
171
- curl -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Access-Token: XXXXXXXXXXXXXX" -X POST -d '{"year": 2015, "month": 10, "price": 5000, "realization_timestamp": "2015-10-31", "customer_master_code": "101", "dept_code": "DEPT A", "reason_master_code": "SALES", "dc": "d", "memo": "500 widgets", "tax_code": 0}' https://tsubaiso.net/ar/create
172
- ```
173
-
174
- **/ar/destroy/:id**
175
-
176
- 説明: 指定された id の売上明細を削除します。成功した場合 204 No Content が返ります。
177
-
178
- HTTP メソッド: POST
179
-
180
- URL 構成例:
181
- ```sh
182
- https://tsubaiso.net/ar/destroy/8833
183
- ```
184
-
185
- #### 仕入・経費明細
186
-
187
- **/ap_payments/list/:year/:month**
188
-
189
- 説明: このエンドポイントは特定の年月の仕入・経費明細の一覧を返します。年月パラメータが指定されなかった場合、現在の月の明細が返されます。
190
-
191
- HTTP メソッド: GET
192
-
193
- URL 構成例:
194
- ``` sh
195
- https://tsubaiso.net/ap_payments/list/2015/10
196
- ```
197
-
198
- JSON レスポンスの例:
199
- ```
200
- [
201
- {
202
- "accrual_timestamp": "2015/10/31 00:00:00 +0900",
203
- "ap_payment_attachments_count": null,
204
- "ap_reason_master_id": 1,
205
- "buying_journal_dc_id": 9835,
206
- "code": null,
207
- "created_at": "2015/10/06 15:45:21 +0900",
208
- "customer_master_id": 8201,
209
- "dc": "c",
210
- "dept_code": "DEPT C",
211
- "id": 6621,
212
- "memo": "Office Supplies for Frank",
213
- "need_tax_deduction": null,
214
- "port_type": 1,
215
- "preset_withholding_tax_amount": null,
216
- "regist_user_code": "sample_user",
217
- "scheduled_memo": null,
218
- "scheduled_pay_timestamp": null,
219
- "update_user_code": null,
220
- "updated_at": "2015/10/06 15:45:21 +0900",
221
- "withholding_tax_base": null,
222
- "withholding_tax_segment": null,
223
- "account_code": "604",
224
- "buying_price": 5000,
225
- "buying_tax": 400,
226
- "buying_tax_type": 0
227
- }, {
228
- "accrual_timestamp": "2015/10/31 00:00:00 +0900",
229
- "ap_payment_attachments_count": null,
230
- "ap_reason_master_id": 1,
231
- "buying_journal_dc_id": 9836,
232
- "code": null,
233
- "created_at": "2015/10/06 15:48:42 +0900",
234
- "customer_master_id": 101,
235
- "dc": "c",
236
- "dept_code": "SETSURITSU",
237
- "id": 622,
238
- "memo": "Television for Cafeteria",
239
- "need_tax_deduction": null,
240
- "port_type": 1,
241
- "preset_withholding_tax_amount": null,
242
- "regist_user_code": "client_user",
243
- "scheduled_memo": null,
244
- "scheduled_pay_timestamp": null,
245
- "update_user_code": null,
246
- "updated_at": "2015/10/06 15:48:42 +0900",
247
- "withholding_tax_base": null,
248
- "withholding_tax_segment": null,
249
- "account_code": "604",
250
- "buying_price": 10000,
251
- "buying_tax": 800,
252
- "buying_tax_type": 0
253
- }
254
- ]
255
- ```
256
-
257
- **/ap_payments/show/:id**
258
-
259
- 説明: このエンドポイントは単一の仕入・経費明細を返します。
260
-
261
- HTTP メソッド: GET
262
-
263
- URL 構成例:
264
- ``` sh
265
- https://tsubaiso.net/ap_payments/show/6621
266
- ```
267
-
268
- JSON レスポンスの例:
269
- ```
270
- {
271
- "accrual_timestamp": "2015/10/31 00:00:00 +0900",
272
- "ap_payment_attachments_count": null,
273
- "ap_reason_master_id": 1,
274
- "buying_journal_dc_id": 9835,
275
- "code": null,
276
- "created_at": "2015/10/06 15:45:21 +0900",
277
- "customer_master_id": 8201,
278
- "dc": "c",
279
- "dept_code": "DEPT C",
280
- "id": 6621,
281
- "memo": "Office Supplies for Frank",
282
- "need_tax_deduction": null,
283
- "port_type": 1,
284
- "preset_withholding_tax_amount": null,
285
- "regist_user_code": "sample_user",
286
- "scheduled_memo": null,
287
- "scheduled_pay_timestamp": null,
288
- "update_user_code": null,
289
- "updated_at": "2015/10/06 15:45:21 +0900",
290
- "withholding_tax_base": null,
291
- "withholding_tax_segment": null,
292
- "account_code": "604",
293
- "buying_price": 5000,
294
- "buying_tax": 400,
295
- "buying_tax_type": 0
296
- }
297
- ```
298
-
299
- **/ap_payments/create**
300
-
301
- 説明: 仕入・経費明細を新規作成します。作成に成功した場合、新規作成された明細が JSON として返されます。
302
-
303
- HTTP メソッド: POST
304
-
305
- URL 構成例:
306
- ```sh
307
- https://tsubaiso.net/ap_payments/create
308
- ```
309
-
310
- Parameters:
311
-
312
- Parameter | Necessity | Type | Description
313
- --- | --- | --- | ---
314
- `price` | *required* | Integer | 発生額(税込)
315
- `accrual_timestamp` | *required* | String | 発生日。 "YYYY-MM-DD" 形式
316
- `customer_master_code` | *required* | String | 取引先コード
317
- `reason_master_code` | *required* | String | 明細の原因コード。仕訳を作成するために使われます。
318
- `dc` | *required* | String | 原因区分。 'd' は「減少」に、'c' は「増加」になります。
319
- `memo` | *required* | String | メモ。値は空文字でも構いませんが必須項目です。
320
- `tax_code` | *required* | Integer | 税区分コード
321
- `port_type` | *required* | Integer | エリア区分。 1 は「国内」、 2 は「国外」
322
- `year` | *optional* | Integer | 明細の年。 年が指定された場合は月も必須項目になります。年が指定されない場合は現在の年が使われます。
323
- `month` | *optional* | Integer | 明細の月。月が指定された場合は年も必須項目になります。月が指定されない場合は現在の月が使われます。
324
- `dept_code` | *optional* | String | 部門コード
325
- `buying_tax` | *optional* | Integer | 消費税額。省略された場合は自動で計算されます。
326
- `scheduled_pay_timestamp` | *optional* | String | 支払予定日。 "YYYY-MM-DD" 形式
327
- `scheduled_memo` | *optional* | String | 支払いに関する追加のメモ
328
- `need_tax_deduction` | *optional* | Integer | 源泉徴収の対象とするか否か。 0:しない, 1:する
329
- `preset_withholding_tax_amount` | *optional* | Integer | 事前設定源泉徴収額
330
- `withholding_tax_base` | *optional* | Integer | 源泉徴収基準額。 1:消費税込額, 2:消費税抜額
331
- `withholding_tax_segment` | *optional* | String | 源泉徴収区分コード (例: "nta2795"。 次のページを参照してください https://www.nta.go.jp/taxanswer/gensen/2795.htm)
332
-
333
- リクエストの例:
334
- ``` sh
335
- curl -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Access-Token: XXXXXXXXXXXXXX" -X POST -d '{"year": 2015, "month": 8, "price": 5000, "accrual_timestamp": "2015-10-31", "customer_master_code": "8201", "dept_code": "DEPT C", "reason_master_code": "BUYING_IN", "dc": "c", "memo": "Office Supplies for Frank", "tax_code": 0, "port_type": 1 }' https://tsubaiso.net/ap_payments/create
336
- ```
337
-
338
- **/ap/destroy/:id**
339
-
340
- 説明: 指定された id の仕入・経費明細を削除します。成功した場合 204 No Content が返ります。
341
-
342
- HTTP メソッド: POST
343
-
344
- URL 構成例:
345
- ```sh
346
- https://tsubaiso.net/ap/destroy/6621
347
- ```