struggle 2.0.5 → 2.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: 0cdb993b1ce68adc13aa2e499e50e0de4db0ea1b
4
- data.tar.gz: c5fca3e0ee7f9c69ed7bb882c956ce76325e5565
3
+ metadata.gz: f5eb5f6370a1a078d7a442b66eb13db0b6795db1
4
+ data.tar.gz: 4955078a8cc2c544df6788c4a8853a476a52714e
5
5
  SHA512:
6
- metadata.gz: a53cf016e4b54544e7cf781447039bdff818b55974c5b292c46acfb1ff307ebea27f4b82f3e36c545b473d4c03bd7649ed1261473dfee2feccc84bb549ad3796
7
- data.tar.gz: 0622bb965c35fd4ceffe173974cc663f5826499002357f1bf6dfcdcb2e44c01be9ad570554914d4f8ebebf3641377c34cf302182099249e0c9c1d7ce1078a8e3
6
+ metadata.gz: 6e66a8266eb32e1d37f33d112c8158264f2ac664945c3dcc5ce1a80fc98af0738a6288802ea3a414b092e6fd72d1eacafc57dc13cc162baaee7daa8a0ab7c34d
7
+ data.tar.gz: e4899226fcbce66804a2bbf22e0aa6c40fd4577962cb7e499857d8e75df2ef1e2ea1685c7538c46818716b15b929214000d12079157ba101783c213e28bd51b9
@@ -1,7 +1,5 @@
1
- module Struggle
2
- class PayGateway
3
- require 'net/https'
4
- require 'uri'
1
+ module Pay
2
+ class JDGateway
5
3
  URL_UTF8 = "https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8"
6
4
  URL = "https://pay3.chinabank.com.cn"
7
5
 
@@ -17,7 +15,7 @@ module Struggle
17
15
  'v_url' => v_url,
18
16
  'key' => key,
19
17
  'v_md5info' => v_md5info,
20
- 'remark1' => remark1,
18
+ 'remark1' => remark1,
21
19
  'remark2' => "[url:=#{remark2}]"
22
20
  }
23
21
  parameter.each do |key, val|
data/lib/pay.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Pay
2
+ end
3
+ begin
4
+ require 'rails'
5
+ rescue LoadError
6
+ #do nothing
7
+ end
8
+ require 'pay/jd_gateway'
@@ -1,5 +1,5 @@
1
1
  module Struggle
2
- class Cipher
2
+ class Aes
3
3
  require 'openssl'
4
4
  def self.encrypt(data, key ,iv)
5
5
  cipher = OpenSSL::Cipher::AES.new(256, :CBC)
@@ -9,7 +9,7 @@ module Struggle
9
9
  Base64.encode64(cipher.update(data) + cipher.final)
10
10
  end
11
11
 
12
- def self.decipher(data, key ,iv)
12
+ def self.decrypt(data, key ,iv)
13
13
  decipher = OpenSSL::Cipher::AES.new(256, :CBC)
14
14
  decipher.decrypt
15
15
  decipher.key = key
@@ -1,18 +1,18 @@
1
1
  #first gem 'rmagick'
2
2
  module Struggle
3
- class Vcode
3
+ class Code
4
4
  #controller
5
5
  #def getcode
6
- # vcode = Vcode.getvcode
7
- # session[:code]=vcode[:code]
8
- # send_data vcode[:img], content_type: 'image/jpeg', disposition: 'inline'
6
+ # code = Code.getcode
7
+ # session[:code]=code[:code]
8
+ # send_data code[:img], content_type: 'image/jpeg', disposition: 'inline'
9
9
  #end
10
10
  #view
11
11
  # <img src="/getcode">
12
- #Vcode.getvcode(90,40,24)
12
+ #Code.getcode(90,40,24)
13
13
  #w宽,h高,fontsize字体大小
14
14
  #返回json类型
15
- def self.getvcode(w=90, h=40, fontsize=24)
15
+ def self.getcode(w=90, h=40, fontsize=24)
16
16
  #创建画布
17
17
  img = Magick::Image.new(w, h) {
18
18
  self.background_color = 'white'
@@ -1,18 +1,18 @@
1
1
  module Struggle
2
2
  module StringExtend
3
- def html_clear
3
+ def htmlClear
4
4
  self.gsub(/<script.*?<\/script>/, "").gsub(/<iframe.*?<\/iframe>/, "")
5
5
  end
6
6
 
7
- def ischinese
7
+ def isCn
8
8
  (self=~/[\u4e00-\u9fa5]/).nil? ? false : true
9
9
  end
10
10
 
11
- def iscn_zn_num
11
+ def isCnOrEn
12
12
  (self=~/^[\u4e00-\u9fa5_a-zA-Z0-9]+$/).nil? ? false : true
13
13
  end
14
14
 
15
- def truncate_u(length = 30, truncate_string = "...")
15
+ def truncate(length = 30, truncate_string = "...")
16
16
  l=0
17
17
  char_array=self.unpack("U*")
18
18
  char_array.each_with_index do |c, i|
@@ -1,5 +1,5 @@
1
1
  module Struggle
2
- class Func
2
+ class Http
3
3
  require 'net/http'
4
4
  require 'net/https'
5
5
  require 'uri'
@@ -6,17 +6,17 @@ module Struggle
6
6
  URL = "http://api.kuaidi100.com/api"
7
7
  URL_loophold = "http://www.kuaidi100.com/query"
8
8
 
9
- def self.send_by_free(id, com, nu, show="json", muti=1, order="desc")
10
- respond = Func.get(URL, {'id' => id, 'com' => com, 'nu' => nu, 'show' => show, 'muti' => muti, 'order' => order})
9
+ def self.send(id, com, nu, show="json", muti=1, order="desc")
10
+ respond = Http.get(URL, {'id' => id, 'com' => com, 'nu' => nu, 'show' => show, 'muti' => muti, 'order' => order})
11
11
  puts respond.body
12
12
  return respond.body.blank? ? nil : JSON.parse(respond.body)
13
13
  end
14
14
 
15
-
16
- def self.send_by_loophold(type, postid)
17
- respond = Func.post(URL_loophold, {'type' => type, 'postid' => postid})
15
+ def self.sendByLoophold(type, postid)
16
+ respond = Http.post(URL_loophold, {'type' => type, 'postid' => postid})
18
17
  return respond.body.blank? ? nil : JSON.parse(respond.body)
19
18
  end
19
+
20
20
  Company = {"anxindakuaixi" => "安信达", "huitongkuaidi" => "汇通快运", "baifudongfang" => "百福东方", "bht" => "BHT", "bangsongwuliu" => "邦送物流",
21
21
  "coe" => "中国东方(COE)", "chuanxiwuliu" => "传喜物流", "datianwuliu" => "大田物流",
22
22
  "debangwuliu" => "德邦物流","dpex" => "DPEX", "dhl" => "DHL-中国件", "dsukuaidi" => "D速快递", "disifang" => "递四方",
data/lib/struggle/sms.rb CHANGED
@@ -5,7 +5,7 @@ module Struggle
5
5
  require 'uri'
6
6
 
7
7
  def Sms.send(uid, pwd, mobile, content)
8
- response = Func.post(URL, {'ac' => "send", 'uid' => uid, 'pwd' => pwd, 'mobile' => mobile, 'content' => content})
8
+ response = Http.post(URL, {'ac' => "send", 'uid' => uid, 'pwd' => pwd, 'mobile' => mobile, 'content' => content})
9
9
  return response.body=="100"
10
10
  end
11
11
  end
data/lib/struggle.rb CHANGED
@@ -6,14 +6,13 @@ rescue LoadError
6
6
  #do nothing
7
7
  end
8
8
  require 'struggle/tfile'
9
- require 'struggle/func'
9
+ require 'struggle/http'
10
10
  require 'struggle/logistic'
11
11
  require 'struggle/pager'
12
- require 'struggle/pay_gateway'
13
12
  require 'struggle/sms'
14
13
  require 'struggle/tmagick'
15
- require 'struggle/vcode'
16
- require 'struggle/cipher'
14
+ require 'struggle/code'
15
+ require 'struggle/aes'
17
16
  require 'struggle/concerns/string_extend'
18
17
  require 'struggle/concerns/int_extend'
19
18
  String.send :include, Struggle::StringExtend
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: struggle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lean
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: vcode,tfile,pager,func,logistic,pay_gateway,tmagick,class_extend,cipher;
41
+ description: code,tfile,pager,http,logistic,pay,tmagick,class_extend,aes;
42
42
  email: 54850915@qq.com
43
43
  executables: []
44
44
  extensions: []
@@ -46,19 +46,20 @@ extra_rdoc_files:
46
46
  - README.md
47
47
  files:
48
48
  - README.md
49
+ - lib/pay.rb
50
+ - lib/pay/jd_gateway.rb
49
51
  - lib/struggle.rb
50
- - lib/struggle/cipher.rb
52
+ - lib/struggle/aes.rb
53
+ - lib/struggle/code.rb
51
54
  - lib/struggle/concerns/int_extend.rb
52
55
  - lib/struggle/concerns/string_extend.rb
53
56
  - lib/struggle/font/font.ttf
54
- - lib/struggle/func.rb
57
+ - lib/struggle/http.rb
55
58
  - lib/struggle/logistic.rb
56
59
  - lib/struggle/pager.rb
57
- - lib/struggle/pay_gateway.rb
58
60
  - lib/struggle/sms.rb
59
61
  - lib/struggle/tfile.rb
60
62
  - lib/struggle/tmagick.rb
61
- - lib/struggle/vcode.rb
62
63
  homepage: http://rubygems.org/gems/struggle
63
64
  licenses:
64
65
  - struggle