kuaidi100 0.0.1 → 0.0.2

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: 619fd2596755fbb3f7bd461342d00163c59dbf40
4
- data.tar.gz: 42cb887b59451e3e85e0af1d8772f07f64eaa58f
3
+ metadata.gz: d9975e25663fdd7fd24cf265ae5b0e04987963cd
4
+ data.tar.gz: 007f00953f3d5807aaf2605d191d9beef0fa8c7c
5
5
  SHA512:
6
- metadata.gz: 8e9e882a9cd10cb9dd6be611fe916fb081c2d048979b3304991c01391c92b0b98d88bfb3bd78b23dbe7114f9b57590f833d39fa9ff0eb3af73443edd2a1bdcce
7
- data.tar.gz: 439428934ad979a641d2887a3b535432982f0c989b632ff6b46371e13db217b955a2f1f3567558abbd5c38a54bb9aa8b2402dcd23f712b569b0f40399c1a1534
6
+ metadata.gz: c16730fd23f98d1078832772493aae3507b9bba4694fc3d0a875d5957da4a28da7a9512e5e46399a456693abbb528a530682985cf51e1d23e7ff079af44d07f8
7
+ data.tar.gz: 2ef39b80deb88a3a9727de804035afeb18c4f3ff60afd1fa1aa32fe684f1f1d693502ac905636b068299644d6290f87300ffbfae43d52e195e8631252705db34
@@ -5,73 +5,73 @@ module Kuaidi100
5
5
  route "post '#{file_name}/show'"
6
6
  route "get '#{file_name}/index'"
7
7
  create_file "app/controllers/#{file_name}_controller.rb", <<-FILE
8
- class #{class_name}Controller < ApplicationController
8
+ class #{class_name}Controller < ApplicationController
9
9
 
10
- def index
11
- end
10
+ def index
11
+ end
12
12
 
13
- def show
13
+ def show
14
14
 
15
- url = URI.parse('http://api.kuaidi100.com/api')
15
+ url = URI.parse('http://api.kuaidi100.com/api')
16
16
 
17
- Net::HTTP.start(url.host, url.port) do |http|
17
+ Net::HTTP.start(url.host, url.port) do |http|
18
18
 
19
- req = Net::HTTP::Post.new(url.path)
19
+ req = Net::HTTP::Post.new(url.path)
20
20
 
21
- req.set_form_data({
22
- id: "",
23
- com: params[:com],
24
- nu: params[:nu],
25
- valicode:"",
26
- show:"2",
27
- muti:"1",
28
- order:"desc"
29
- })
21
+ req.set_form_data({
22
+ id: "",
23
+ com: params[:com],
24
+ nu: params[:nu],
25
+ valicode:"",
26
+ show:"2",
27
+ muti:"1",
28
+ order:"desc"
29
+ })
30
30
 
31
- puts http.request(req).body
31
+ puts http.request(req).body
32
32
 
33
- @content = http.request(req).body.force_encoding("UTF-8")
33
+ @content = http.request(req).body.force_encoding("UTF-8")
34
34
 
35
- end
36
35
  end
37
- end
36
+ end
37
+ end
38
38
  FILE
39
39
  end
40
40
 
41
41
  def create_view_file
42
42
  create_file "app/views/#{file_name}/index.html.haml", <<-FILE
43
- =form_tag #{file_name}_show_path,role:"form" do |f|
44
- .form-group
45
- %label 快递单号:
46
- =text_field_tag :nu
47
- .form-group
48
- .col-md-3
49
- =select_tag 'com', options_for_select(get_com_hash.collect{ |ch| [ ch[1], ch[0] ] }), class:"form-control"
50
- .form-group
51
- =submit_tag "自助查询", class: "btn btn-success"
43
+ =form_tag #{file_name}_show_path,role:"form" do |f|
44
+ .form-group
45
+ %label 快递单号:
46
+ =text_field_tag :nu
47
+ .form-group
48
+ .col-md-3
49
+ =select_tag 'com', options_for_select(get_com_hash.collect{ |ch| [ ch[1], ch[0] ] }), class:"form-control"
50
+ .form-group
51
+ =submit_tag "自助查询", class: "btn btn-success"
52
52
  FILE
53
53
 
54
54
  create_file "app/views/#{file_name}/show.html.haml", <<-FILE
55
- %hr
56
- :javascript
57
- document.write("#{'#{@content}'}");
55
+ %hr
56
+ :javascript
57
+ document.write("#{'#{@content}'}");
58
58
  FILE
59
59
  end
60
60
 
61
61
  def create_helper_file
62
62
  create_file "app/helpers/#{file_name}_helper.rb", <<-FILE
63
- module #{class_name}Helper
64
- def get_com_hash
65
- @com_hash ={
66
- "tiantian"=>"天天",
67
- "shentong"=>"申通",
68
- "yuantong"=>"圆通",
69
- "shunfeng"=>"顺丰",
70
- "debangwuliu"=>"德邦",
71
- "yunda"=>"韵达"
72
- }
73
- end
63
+ module #{class_name}Helper
64
+ def get_com_hash
65
+ @com_hash ={
66
+ "tiantian"=>"天天",
67
+ "shentong"=>"申通",
68
+ "yuantong"=>"圆通",
69
+ "shunfeng"=>"顺丰",
70
+ "debangwuliu"=>"德邦",
71
+ "yunda"=>"韵达"
72
+ }
74
73
  end
74
+ end
75
75
  FILE
76
76
  end
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module Kuaidi100
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -1,4 +1,4 @@
1
1
  # desc "Explaining what the task does"
2
2
  # task :kuaidi100 do
3
3
  # # Task goes here
4
- # end
4
+ # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuaidi100
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mr.Passer-by
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-17 00:00:00.000000000 Z
11
+ date: 2014-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails