ne_api 0.0.8 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +15 -2
- data/config/api.yaml +14 -0
- data/lib/ne_api.rb +10 -9
- data/lib/ne_api/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 59d7891130fedebd87824c21b86178accc5ba581317cf50baeb24dee814b4a98
|
4
|
+
data.tar.gz: 70360be450dfb469213093be94bbf628964ef9129fec0ad1c4f4fd5f8d21314e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f7add295a9eea58e07c487eecd98ece3fbc8261cf8f21a4172ff2ae621a857aee07aab422cfb8529133335e4f419bfb4d273aa9cf3e77813954559de5e47d89
|
7
|
+
data.tar.gz: ee580da759b9daba3a8a4be392b59c204e444be3c0211c9ef40b3ba6d0ab132e01ab34254ee5f800eeae5bf806a905daa7b386e6787b233d02af97e4fe12c642
|
data/README.md
CHANGED
@@ -24,6 +24,11 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
please read [API Document](http://api.next-e.jp/).
|
26
26
|
|
27
|
+
## Global Environment
|
28
|
+
|
29
|
+
CLIENT_ID ....... Get it from Next-Engine's 「アプリを作る」->「API」->「クライアントID」 page
|
30
|
+
CLIENT_SECRET ... Get it from Next-Engine's 「アプリを作る」->「API」->「クライアントシークレット」 page
|
31
|
+
|
27
32
|
## Sample Application
|
28
33
|
|
29
34
|
```ruby
|
@@ -35,12 +40,12 @@ class MyApp < Sinatra::Base
|
|
35
40
|
CLIENT_SECRET = "XXXX"
|
36
41
|
CALLBACK_URI = "https://localhost:3000/callback"
|
37
42
|
get "/" do
|
38
|
-
"<a href=" + NeAPI::NE_SERVER_HOST + NeAPI::Auth::SIGN_IN_PATH + "?client_id="+CLIENT_ID+"&
|
43
|
+
"<a href=" + NeAPI::NE_SERVER_HOST + NeAPI::Auth::SIGN_IN_PATH + "?client_id="+CLIENT_ID+"&redirect_uri="+ CALLBACK_URI + ">Connect with Next Engine</a>"
|
39
44
|
end
|
40
45
|
|
41
46
|
get "/callback" do
|
42
47
|
auth = NeAPI::Auth.new redirect_url: CALLBACK_URI
|
43
|
-
res = auth.ne_auth params[:uid], params[:state]
|
48
|
+
res = auth.ne_auth params[:uid], params[:state], CLIENT_ID, CLIENT_SECRET
|
44
49
|
session[:access_token] = res["access_token"]
|
45
50
|
session[:refresh_token] = res["refresh_token"]
|
46
51
|
redirect "/home"
|
@@ -107,6 +112,14 @@ end
|
|
107
112
|
5. Create a new Pull Request
|
108
113
|
|
109
114
|
## Update
|
115
|
+
### ver0.0.12
|
116
|
+
* 受注伝票一括更新・納品書印刷済み一括更新に対応
|
117
|
+
|
118
|
+
### ver0.0.11
|
119
|
+
* NEのログイン認証方式に変更
|
120
|
+
|
121
|
+
### ver0.0.9
|
122
|
+
* リトライすべきエラーメッセージについてリトライするようにした
|
110
123
|
|
111
124
|
### ver0.0.8
|
112
125
|
* NextEngineのAPIにあわせて、最新の定義を追加
|
data/config/api.yaml
CHANGED
@@ -198,6 +198,11 @@
|
|
198
198
|
- search
|
199
199
|
:prefix: mall_category
|
200
200
|
:fields: id,mall_id,code,parent_mall_category_id,name,full_name
|
201
|
+
:system_deliverydate:
|
202
|
+
:method:
|
203
|
+
- info
|
204
|
+
:prefix: delivery_date
|
205
|
+
:fields: id,name,days,note
|
201
206
|
:receiveorder_uploadpattern:
|
202
207
|
:method:
|
203
208
|
- info
|
@@ -211,6 +216,8 @@
|
|
211
216
|
- shipped
|
212
217
|
- labelprinted
|
213
218
|
- divide
|
219
|
+
- bulkupdate
|
220
|
+
- bulkupdatereceipted
|
214
221
|
:prefix: receive_order
|
215
222
|
:fields: shop_id,id,shop_cut_form_id,date,import_date,important_check_id,important_check_name,confirm_check_id,confirm_check_name,confirm_ids,mail_status,gruoping_tag,import_type_id,import_type_name,cancel_type_id,cancel_type_name,cancel_date,closed_after_edit_date,order_status_id,order_status_name,delivery_id,delivery_name,payment_method_id,payment_method_name,total_amount,tax_amount,charge_amount,delivery_fee_amount,other_amount,point_amount,goods_amount,deposit_amount,deposit_type_id,deposit_type_name,deposit_date,foreign_total_amount,foreign_tax_amount,foreign_charge_amount,foreign_delivery_fee_amount,foreign_other_amount,foreign_goods_amount,foreign_deposit_amount,note,include_possible_order_id,include_to_order_id,multi_delivery_parent_order_id,multi_delivery_parent_flag,statement_delivery_instruct_printing_date,statement_delivery_printing_date,statement_delivery_text,send_date,send_plan_date,send_sequence,worker_text,picking_instruct,picking_min_supplier_id,picking_min_goods_id,label_print_date,label_print_flag,hope_delivery_date,hope_delivery_time_slot_id,hope_delivery_time_slot_name,delivery_method_id,delivery_method_name,seal1_id,seal1_name,seal2_id,seal2_name,seal3_id,seal3_name,seal4_id,seal4_name,business_office_stop_id,business_office_stop_name,invoice_id,invoice_name,temperature_id,temperature_name,business_office_name,gift_flag,delivery_cut_form_id,delivery_cut_form_note,credit_type_id,credit_type_name,credit_approval_no,credit_approval_amount,credit_approval_type_id,credit_approval_type_name,credit_approval_date,credit_approval_rate,credit_number_payments,credit_authorization_center_id,credit_authorization_center_name,credit_approval_fax_printing_date,customer_type_id,customer_type_name,customer_id,purchaser_name,purchaser_kana,purchaser_zip_code,purchaser_address1,purchaser_address2,purchaser_tel,purchaser_fax,purchaser_mail_address,consignee_name,consignee_kana,consignee_zip_code,consignee_address1,consignee_address2,consignee_tel,consignee_fax,reminder_start_date,reminder_last_date,reminder_count,important_check_pic_id,important_check_pic_name,pic_id,pic_name,send_pic_id,send_pic_name,deleted_flag,creation_date,last_modified_date,last_modified_null_safe_date,creator_id,creator_name,last_modified_by_id,last_modified_by_null_safe_id,last_modified_by_name,last_modified_by_null_safe_name
|
216
223
|
:receiveorder_option:
|
@@ -244,3 +251,10 @@
|
|
244
251
|
- search
|
245
252
|
:prefix: payment_delivery_convert
|
246
253
|
:fields: text,type,multi_id,delivery_id,deleted_flag,creation_date,last_modified_date,creator_id,creator_name,last_modified_by_id,last_modified_by_name
|
254
|
+
:notice_execution:
|
255
|
+
:method:
|
256
|
+
- add
|
257
|
+
- count
|
258
|
+
- search
|
259
|
+
:prefix: execution_notice
|
260
|
+
:fields: id,success,title,content,read,creation_date,last_modified_date
|
data/lib/ne_api.rb
CHANGED
@@ -14,17 +14,18 @@ module NeAPI
|
|
14
14
|
|
15
15
|
|
16
16
|
def conn
|
17
|
-
@conn ||=
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
@conn ||= Faraday.new(:url => API_SERVER_HOST) do |faraday|
|
18
|
+
faraday.request :url_encoded # form-encode POST params
|
19
|
+
faraday.response :logger # log requests to STDOUT
|
20
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
21
|
+
faraday.options[:timeout] = 600
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
25
|
def response response
|
25
26
|
body = JSON.parse response.body
|
26
27
|
if body["result"] != "success"
|
27
|
-
if
|
28
|
+
if ["003001","003002","008003","009005","011007"].include?(body["code"])
|
28
29
|
return false
|
29
30
|
else
|
30
31
|
raise NeAPIException, sprintf("%s:%s", body["code"], body["message"])
|
@@ -114,7 +115,7 @@ module NeAPI
|
|
114
115
|
get_key = "data"
|
115
116
|
when "info"
|
116
117
|
query = nil
|
117
|
-
when "update", "upload", "receipted", "shipped", "labelprinted"
|
118
|
+
when "update", "upload", "receipted", "shipped", "labelprinted", "add"
|
118
119
|
get_key = "result"
|
119
120
|
when "divide"
|
120
121
|
get_key = "receive_order_id"
|
@@ -145,12 +146,12 @@ module NeAPI
|
|
145
146
|
|
146
147
|
#uid/state取得
|
147
148
|
def sign_in client_id = ENV["CLIENT_ID"] , client_secret = ENV["CLIENT_SECRET"]
|
148
|
-
Launchy.open NE_SERVER_HOST + SIGN_IN_PATH + "?client_id="+client_id+"&
|
149
|
+
Launchy.open NE_SERVER_HOST + SIGN_IN_PATH + "?client_id="+client_id+"&redirect_uri="+@redirect_url
|
149
150
|
end
|
150
151
|
|
151
152
|
#access_token/企業情報取得
|
152
|
-
def ne_auth uid, state
|
153
|
-
@ne_user = response ( conn.post NEAUTH_PATH, {uid: uid, state: state})
|
153
|
+
def ne_auth uid, state, client_id = ENV["CLIENT_ID"], client_secret = ENV["CLIENT_SECRET"]
|
154
|
+
@ne_user = response ( conn.post NEAUTH_PATH, {uid: uid, state: state, client_id: client_id, client_secret: client_secret})
|
154
155
|
raise NeAPIException, "003001:Next Engineが大変混み合っているようです" if @ne_user == false
|
155
156
|
@ne_user
|
156
157
|
end
|
data/lib/ne_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ne_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuuna Kurita
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -174,8 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
|
178
|
-
rubygems_version: 2.2.2
|
177
|
+
rubygems_version: 3.0.3
|
179
178
|
signing_key:
|
180
179
|
specification_version: 4
|
181
180
|
summary: Next Engine API for ruby
|