struggle 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bbf88fe4cb0e679ed14abd2ccc9fcc9688231d1
4
- data.tar.gz: 49e005b94ebffaed197071833cf52d85fe76572e
3
+ metadata.gz: af26ed68fb6fa7c5b83d7a822184485f63fdf0f4
4
+ data.tar.gz: d3ff71e8229203ebc043181df16dc714d45c091f
5
5
  SHA512:
6
- metadata.gz: f147766b13ea1c80957937643bff582806a43b9b05b3544a54971e3a8c2f4756262a4726ec0143241aad87d444a04caf21554d64ba7bc3e4650b5417c6582b6e
7
- data.tar.gz: b573ae89712ea8c06f6cf1e2a6f2636c13bd416397efde16b7dfe93c837028a346093395c29246fc2f8e631ccc7a64c929ea885863d9bddccb3e5690c7839f4e
6
+ metadata.gz: 02a647d55b9ef470ed208d3060b3fc78f37507859270763bbb615034369062ba6cdb56e0d913ed6eab5a5ea0e5e2170ae1b3c1a447bd889dd26bff487e3595e5
7
+ data.tar.gz: 1057c15f4f4708c88bc8744e034265a675369409b90ef813a264636a3daaea608b888765801e0f10ff2b5bbe7166a4cbe4e7c98feed8ce6164bf70c8437b8333
@@ -0,0 +1,105 @@
1
+ module Struggle
2
+ class Logistics
3
+ require 'net/https'
4
+ require 'uri'
5
+ require 'json'
6
+ URL = "http://api.kuaidi100.com/api"
7
+ URL_loophold = "http://www.kuaidi100.com/query"
8
+ # 快递100免费物流码接口
9
+ # 参数:
10
+ # id String 是 身份授权key,请 快递查询接口 进行申请(大小写敏感)
11
+ # com String 是 要查询的快递公司代码,不支持中文,对应的公司代码见
12
+ # nu String 是 要查询的快递单号,请勿带特殊符号,不支持中文(大小写不敏感)
13
+ # show String 是 返回类型:
14
+ # 0:返回json字符串,
15
+ # 1:返回xml对象,
16
+ # 2:返回html对象,
17
+ # 3:返回text文本。
18
+ # 如果不填,默认返回json字符串。
19
+ # muti String 是 返回信息数量:
20
+ # 1:返回多行完整的信息,
21
+ # 0:只返回一行信息。
22
+ # 不填默认返回多行。
23
+ # order String 是 排序:
24
+ # desc:按时间由新到旧排列,
25
+ # asc:按时间由旧到新排列。
26
+ # 不填默认返回倒序(大小写不敏感)
27
+ # 返回:json格式数据
28
+ # com 物流公司编号
29
+ # nu 物流单号
30
+ # time 每条跟踪信息的时间
31
+ # context 每条跟综信息的描述
32
+ # state 快递单当前的状态 : 
33
+ # 0:在途,即货物处于运输过程中;
34
+ # 1:揽件,货物已由快递公司揽收并且产生了第一条跟踪信息;
35
+ # 2:疑难,货物寄送过程出了问题;
36
+ # 3:签收,收件人已签收;
37
+ # 4:退签,即货物由于用户拒签、超区等原因退回,而且发件人已经签收;
38
+ # 5:派件,即快递正在进行同城派件;
39
+ # 6:退回,货物正处于退回发件人的途中;
40
+ # 该状态还在不断完善中,若您有更多的参数需求,欢迎发邮件至 kuaidi@kingdee.com 提出。
41
+ # status 查询结果状态:
42
+ # 0:物流单暂无结果,
43
+ # 1:查询成功,
44
+ # 2:接口出现异常,
45
+ def self.send_by_free(id, com, nu, show="json", muti=1, order="desc")
46
+ respond = Func.get(URL, {'id' => id, 'com' => com, 'nu' => nu, 'show' => show, 'muti' => muti, 'order' => order})
47
+ puts respond.body
48
+ return respond.body.blank? ? nil : JSON.parse(respond.body)
49
+ end
50
+
51
+ # 快递100免费物流码接口
52
+ # 参数:
53
+ # type: 物流公司
54
+ # postid: 物流码
55
+ #返回结果实例:json类型
56
+ #{"message":"ok","nu":"200093247451","ischeck":"1","com":"yuantong","status":"200","condition":"F00","state":"3",
57
+ # "data":
58
+ # [{"time":"2015-04-15 09:09:56","context":"客户 签收人 : 张 已签收","ftime":"2015-04-15 09:09:56"},
59
+ # {"time":"2015-04-15 09:03:00","context":"山东省潍坊市潍城区十笏园分部公司派件人 : 邹辉 派件中 派件员电话","ftime":"2015-04-15 09:03:00"},
60
+ # {"time":"2015-04-14 09:09:16","context":"山东省潍坊市潍城区十笏园分部公司 失败签收录入 于明鑫","ftime":"2015-04-14 09:09:16"},
61
+ # {"time":"2015-04-14 09:03:59","context":"山东省潍坊市潍城区十笏园分部公司派件人 : 邹辉 派件中 派件员电话","ftime":"2015-04-14 09:03:59"},
62
+ # {"time":"2015-04-14 07:15:57","context":"快件到达 山东省潍坊市潍城区十笏园分部公司","ftime":"2015-04-14 07:15:57"},
63
+ # {"time":"2015-04-14 05:50:25","context":"山东省潍坊市公司 已发出,下一站 山东省潍坊市潍城区十笏园分部","ftime":"2015-04-14 05:50:25"},
64
+ # {"time":"2015-04-14 04:07:09","context":"潍坊转运中心公司 已发出,下一站 山东省潍坊市","ftime":"2015-04-14 04:07:09"},
65
+ # {"time":"2015-04-11 19:30:06","context":"浙江省金华市义乌市凌云公司 已打包,发往下一站 潍坊转运中心","ftime":"2015-04-11 19:30:06"},
66
+ # {"time":"2015-04-11 17:58:41","context":"浙江省金华市义乌市凌云公司 已揽收","ftime":"2015-04-11 17:58:41"}]
67
+ # }
68
+ def self.send_by_loophold(type, postid)
69
+ respond = Func.post(URL_loophold, {'type' => type, 'postid' => postid})
70
+ return respond.body.blank? ? nil : JSON.parse(respond.body)
71
+ end
72
+
73
+ Company = {"auspost" => "澳大利亚邮政", "aae" => "AAE", "anxindakuaixi" => "安信达", "huitongkuaidi" => "汇通快运", "baifudongfang" => "百福东方", "bht" => "BHT", "bangsongwuliu" => "邦送物流",
74
+ "cces" => "希伊艾斯(CCES)", "coe" => "中国东方(COE)", "chuanxiwuliu" => "传喜物流", "canpost" => "加拿大邮政-英文", "canpostfr" => "加拿大邮政-德文", "datianwuliu" => "大田物流",
75
+ "debangwuliu" => "德邦物流","dpex" => "DPEX", "dhl" => "DHL-中国件", "dhlen" => "DHL-国际件-英文", "dhlde" => "DHL-德国件-德文", "dsukuaidi" => "D速快递", "disifang" => "递四方",
76
+ "ems" => "EMS-(中国-中国)件", "ems" => "E邮宝-(中国-中国)件", "emsen" => "EMS-(中国-中国)件-英文", "emsguoji" => "EMS-(中国-国际)件", "emsinten" => "EMS-(中国-国际)件-英文",
77
+ "fedex" => "Fedex-国际件", "fedexcn" => "Fedex-国际件", "fedexus" => "Fedex-美国件", "feikangda" => "飞康达物流", "feikuaida" => "飞快达", "rufengda" => "凡客如风达",
78
+ "fengxingtianxia" => "风行天下", "feibaokuaidi" => "飞豹快递", "ganzhongnengda" => "港中能达", "guotongkuaidi" => "国通快递", "guangdongyouzhengwuliu" => "广东邮政",
79
+ "youzhengguonei" => "邮政包裹、挂号信-中国件", "youzhengguoji" => "邮政包裹、挂号信-国际件", "gongsuda" => "共速达", "gls" => "GLS", "huiqiangkuaidi"=>"汇强快递","tiandihuayu"=>"华宇物流",
80
+ "hengluwuliu"=>"恒路物流","huaxialongwuliu"=>"华夏龙","tiantian"=>"海航天天", "haiwaihuanqiu"=>"海外环球","hebeijianhua"=>"河北建华","haimengsudi"=>"海盟速递","huaqikuaiyun"=>"华企快运",
81
+ "haihongwangsong"=>"山东海红","jiajiwuliu"=>"佳吉物流", "jiayiwuliu"=>"佳怡物流","jiayunmeiwuliu"=>"加运美","jinguangsudikuaijian"=>"京广速递","jixianda"=>"急先达","jinyuekuaidi"=>"晋越快递",
82
+ "jietekuaidi"=>"捷特快递","jindawuliu"=>"金大物流", "jialidatong"=>"嘉里大通","kuaijiesudi"=>"快捷速递","kangliwuliu"=>"康力物流","kuayue"=>"跨越物流","lianhaowuliu"=>"联昊通",
83
+ "longbanwuliu"=>"龙邦物流","lanbiaokuaidi"=>"蓝镖快递","lejiedi"=>"乐捷递","lianbangkuaidi" => "Fedex-中国件", "lianbangkuaidien" => "Fedex-中国件-英文", "lijisong"=>"立即送",
84
+ "longlangkuaidi"=>"隆浪快递","menduimen"=>"门对门","meiguokuaidi"=>"美国快递","mingliangwuliu"=>"明亮物流","ocs"=>"OCS","ontrac"=>"onTrac","quanchenkuaidi"=>"全晨快递",
85
+ "quanjitong"=>"全际通","quanritongkuaidi"=>"全日通","quanyikuaidi"=>"全一快递","quanfengkuaidi"=>"全峰快递", "sevendays"=>"七天连锁","rufengda"=>"如风达快递","shentong"=>"伸通",
86
+ "shunfeng"=>"顺丰速递", "shunfengen"=>"顺丰-英文","santaisudi"=>"三态速递","shenghuiwuliu"=>"盛辉物流","suer"=>"速尔物流","shengfengwuliu"=>"盛丰物流","shangda"=>"上大物流",
87
+ "santaisudi"=>"三态速递","haihongwangsong"=>"山东海红","saiaodi"=>"赛澳递","haihongwangsong"=>"山东海红", "sxhongmajia"=>"山西红马甲","shenganwuliu"=>"圣安物流","suijiawuliu"=>"穗佳物流",
88
+ "tiandihuayu"=>"天地华宇","tiantian"=>"天天快递", "tnt" => "TNT-中文", "tnten" => "TNT-英文", "ups" => "UPS-中文", "upsen" => "UPS-英文", "usps" => "USPS", "tonghetianxia"=>"通和天下",
89
+ "youshuwuliu"=>"优速物流", "wanjiawuliu"=>"万家物流", "wanxiangwuliu"=>"万象物流", "weitepai"=>"微特派", "xinbangwuliu"=>"新邦物流", "xinfengwuliu"=> "信丰物流",
90
+ "xingchengjibian"=>"星晨急便", "xinhongyukuaidi"=>"鑫飞鸿", "cces"=>"希伊艾斯(CCES)", "xinbangwuliu"=>"新邦物流", "neweggozzo"=>"新蛋奥硕物流", "hkpost"=>"香港邮政", "yuantong"=>"圆通速递",
91
+ "yunda"=>"韵达快运", "yuntongkuaidi"=> "运通快递", "yuanchengwuliu"=>"远成物流", "yafengsudi"=>"亚风速递", "yibangwuliu"=> "一邦速递", "youshuwuliu"=>"优速物流", "yuanweifeng"=>"源伟丰快递",
92
+ "yuanzhijiecheng"=>"元智捷诚", "yuefengwuliu"=>"越丰物流", "yuananda"=>"源安达", "yuanfeihangwuliu"=>"原飞航", "zhongxinda"=>"忠信达快递", "zhimakaimen"=>"芝麻开门", "yinjiesudi"=>"银捷速递",
93
+ "yitongfeihong"=>"一统飞鸿", "zhongtong"=>"中通速递", "zhaijisong"=>"宅急送", "zhongyouwuliu"=>"中邮物流", "zhongxinda"=>"忠信达", "zhongsukuaidi"=>"中速快件", "zhimakaimen"=>"芝麻开门",
94
+ "zhengzhoujianhua"=>"郑州建华", "zhongtianwanyun"=>"中天万运"}
95
+
96
+ GuoJi_Company = {"auspost" => "澳大利亚邮政", "aramex" => "Aramex", "bpost" => "比利时邮政", "bpostinter" => "比利时邮政国际件", "canpost" => "加拿大邮政", "canpostfr" => "加拿大邮政", "citylink" => "City-Link",
97
+ "dpex" => "DPEX", "dpexen" => "DPEX", "dhl" => "DHL-中国件", "dhlen" => "DHL-国际件", "dhlde" => "DHL-德国件", "ems" => "EMS-(中国-中国)件", "ems" => "E邮宝-(中国-中国)件", "emsen" => "EMS-(中国-中国)件-英文",
98
+ "emsguoji" => "EMS-(中国-国际)件", "emsinten" => "EMS-(中国-国际)件-英文", "fedex" => "Fedex-国际件", "fedexcn" => "Fedex-国际件", "fedexus" => "Fedex-美国件", "gls" => "GLS", "hkpost" => "香港邮政",
99
+ "lianbangkuaidi" => "Fedex-中国件", "lianbangkuaidien" => "Fedex-中国件-英文", "ruidianyouzheng" => "瑞典邮政包裹小包", "singpost" => "新加坡邮政包裹小包", "tnt" => "TNT-中文", "tnten" => "TNT-英文",
100
+ "ups" => "UPS-中文", "upsen" => "UPS-英文", "usps" => "USPS", "youzhengguonei" => "邮政包裹、挂号信-中国件", "youzhengguoji" => "邮政包裹、挂号信-国际件", "zhongyouwuliu" => "中邮物流"}
101
+
102
+ end
103
+ end
104
+
105
+
data/lib/struggle.rb CHANGED
@@ -7,6 +7,7 @@ rescue LoadError
7
7
  end
8
8
  require 'struggle/fileupload'
9
9
  require 'struggle/func'
10
+ require 'struggle/logistics'
10
11
  require 'struggle/pager'
11
12
  require 'struggle/pay_gateway'
12
13
  require 'struggle/sms'
data/struggle.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'struggle'
3
- s.version = '1.0.1'
4
- s.date = '2015-06-20'
3
+ s.version = '1.1.0'
4
+ s.date = '2015-06-24'
5
5
  s.summary = "struggle!"
6
- s.description = "vcode,fileupload,pager,func,pay_gateway,tmagick;"
6
+ s.description = "vcode,fileupload,pager,func,logistics,pay_gateway,tmagick;"
7
7
  s.authors = ["lean"]
8
8
  s.email = '54850915@qq.com'
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.extra_rdoc_files = ['README.md']
11
- s.require_paths = ['lib']
11
+ #s.require_paths = ['lib']
12
12
  s.add_development_dependency 'iconv', ['>= 0']
13
13
  s.add_development_dependency 'rmagick', ['>= 0']
14
14
  s.homepage = 'http://rubygems.org/gems/struggle'
metadata CHANGED
@@ -1,44 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: struggle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-20 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iconv
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rmagick
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: vcode,fileupload,pager,func,pay_gateway,tmagick;
41
+ description: vcode,fileupload,pager,func,logistics,pay_gateway,tmagick;
42
42
  email: 54850915@qq.com
43
43
  executables: []
44
44
  extensions: []
@@ -49,6 +49,7 @@ files:
49
49
  - lib/struggle.rb
50
50
  - lib/struggle/fileupload.rb
51
51
  - lib/struggle/func.rb
52
+ - lib/struggle/logistics.rb
52
53
  - lib/struggle/pager.rb
53
54
  - lib/struggle/pay_gateway.rb
54
55
  - lib/struggle/sms.rb
@@ -65,17 +66,17 @@ require_paths:
65
66
  - lib
66
67
  required_ruby_version: !ruby/object:Gem::Requirement
67
68
  requirements:
68
- - - '>='
69
+ - - ">="
69
70
  - !ruby/object:Gem::Version
70
71
  version: '0'
71
72
  required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - '>='
74
+ - - ">="
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
78
  rubyforge_project:
78
- rubygems_version: 2.4.8
79
+ rubygems_version: 2.4.7
79
80
  signing_key:
80
81
  specification_version: 4
81
82
  summary: struggle!