wechat-jsapi 0.1 → 0.1.1

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: 74f29dde84594ff8c5d381942dae11bb17680570
4
- data.tar.gz: 3706cb8f6951d4848e0585d43404d248064a5717
3
+ metadata.gz: aa94a91d29d581087e7e1ee293c66e0be9bfa759
4
+ data.tar.gz: f3f89efc91113bd9bebd62079c5fa4c6471c965e
5
5
  SHA512:
6
- metadata.gz: e3a65b26c85e268532db04baeb5b2298eaafe6c3a6ecebe167a5340c641b452d04f98951c08ed3d27d5082fbc7260f1013e7e3e9fbe8c5e0e8177e32d06d2daf
7
- data.tar.gz: 2339e7e9671b4799b782d0fb4c431b7cf75668cfac4760c1aa87df7121337af30ec940b49c6e645415a11bb1f7db339268cdf725f3d77d2105095ab40b4a8aa8
6
+ metadata.gz: 12ff93b44a45a34693e121e457230495a0473e11a9f1fc22025893dee6cf631b4ec4c54598673b8f235e0471b92f6187b5bc6af7ea1c4a69d3c7fadebd76fec4
7
+ data.tar.gz: 4e86ed09953196620e9821e459d01e98e82dea13da5bee3cbe475904aabafb1b7b642fd1bbaf0f86dabfaed0262e369154eb5098703a0febb4b09dfa0e4b4ead
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
@@ -2,4 +2,9 @@
2
2
 
3
3
  ## v0.1
4
4
  1. Signature class
5
- 2. Ticket class
5
+ 2. Ticket wrapper class
6
+
7
+ ## v0.1.1
8
+ 1. Improve the Ruby Gem Specification to depend on [wechat-core](https://github.com/topbitdu/wechat-core) v0.4
9
+ 2. Improve the Signature class for the argument validation
10
+ 3. Improve the Ticket wrapper class for the argument validation & HTTP request
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in wechat-sns.gemspec
3
+ # Specify your gem's dependencies in wechat-jsapi.gemspec
4
4
  gemspec
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wechat-jsapi (0.1)
5
+ wechat-core (~> 0.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.2.5)
11
+ httpclient (2.8.0)
12
+ rake (10.5.0)
13
+ rspec (3.4.0)
14
+ rspec-core (~> 3.4.0)
15
+ rspec-expectations (~> 3.4.0)
16
+ rspec-mocks (~> 3.4.0)
17
+ rspec-core (3.4.4)
18
+ rspec-support (~> 3.4.0)
19
+ rspec-expectations (3.4.0)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.4.0)
22
+ rspec-mocks (3.4.1)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.4.0)
25
+ rspec-support (3.4.1)
26
+ wechat-core (0.3)
27
+ httpclient (~> 2.7)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 1.11)
34
+ rake (~> 10.0)
35
+ rspec (~> 3.0)
36
+ wechat-jsapi!
37
+
38
+ BUNDLED WITH
39
+ 1.12.5
data/README.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # Wechat JS API Library 微信JS API库
2
2
 
3
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/wechat-jsapi/frames)
3
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
5
+
4
6
  [![Gem Version](https://badge.fury.io/rb/wechat-jsapi.svg)](https://badge.fury.io/rb/wechat-jsapi)
7
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/wechat-jsapi.svg)](https://gemnasium.com/github.com/topbitdu/wechat-jsapi)
5
8
 
6
9
  Wechat JS API library is a low level library for Wechat JS APIs. 微信JS API库是一个调用[微信JS API](http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html)的低层库。
7
10
 
11
+
12
+
13
+ ## Recent Update
14
+
15
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
16
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
17
+
18
+
19
+
8
20
  ## Installation
9
21
 
10
22
  Add this line to your application's Gemfile:
@@ -21,6 +33,8 @@ Or install it yourself as:
21
33
 
22
34
  $ gem install wechat-jsapi
23
35
 
36
+
37
+
24
38
  ## Usage
25
39
 
26
40
  [Signature 签名算法](http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.99.84.E5.BD.951-JS-SDK.E4.BD.BF.E7.94.A8.E6.9D.83.E9.99.90.E7.AD.BE.E5.90.8D.E7.AE.97.E6.B3.95)
@@ -39,18 +53,22 @@ else
39
53
  end
40
54
  ```
41
55
 
56
+
57
+
42
58
  ## Development
43
59
 
44
60
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
61
 
46
62
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
63
 
64
+
65
+
48
66
  ## Contributing
49
67
 
50
68
  Bug reports and pull requests are welcome on GitHub at https://github.com/topbitdu/wechat-jsapi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
69
 
52
70
 
71
+
53
72
  ## License
54
73
 
55
74
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
56
-
data/ROADMAP.md CHANGED
@@ -2,4 +2,9 @@
2
2
 
3
3
  ## v0.1
4
4
  1. Signature class
5
- 2. Ticket class
5
+ 2. Ticket wrapper class
6
+
7
+ ## v0.1.1
8
+ 1. Improve the Ruby Gem Specification to depend on [wechat-core](https://github.com/topbitdu/wechat-core) v0.4
9
+ 2. Improve the Signature class for the argument validation
10
+ 3. Improve the Ticket wrapper class for the argument validation & HTTP request
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -0,0 +1 @@
1
+ markdown: kramdown
@@ -1,9 +1,19 @@
1
1
  class Wechat::JSAPI::Signature
2
2
 
3
+ extend Wechat::Core::Common
4
+
5
+ ##
3
6
  # 生成JS-SDK权限验证的签名
4
7
  # http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.99.84.E5.BD.951-JS-SDK.E4.BD.BF.E7.94.A8.E6.9D.83.E9.99.90.E7.AD.BE.E5.90.8D.E7.AE.97.E6.B3.95
5
8
  def self.create(link, ticket, timestamp, nonce)
9
+
10
+ assert_present! :link, link
11
+ assert_present! :ticket, ticket
12
+ assert_present! :timestamp, timestamp
13
+ assert_present! :nonce, nonce
14
+
6
15
  Digest::SHA1.hexdigest [ "url=#{link}", "jsapi_ticket=#{ticket}", "timestamp=#{timestamp}", "noncestr=#{nonce}" ].sort.join('&')
16
+
7
17
  end
8
18
 
9
19
  end
@@ -1,9 +1,8 @@
1
- require 'jsonclient'
2
-
3
1
  class Wechat::JSAPI::Ticket
4
2
 
5
- extend ::Wechat::Core::Common
3
+ extend Wechat::Core::Common
6
4
 
5
+ ##
7
6
  # 获得jsapi_ticket
8
7
  # http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E9.99.84.E5.BD.951-JS-SDK.E4.BD.BF.E7.94.A8.E6.9D.83.E9.99.90.E7.AD.BE.E5.90.8D.E7.AE.97.E6.B3.95
9
8
  #
@@ -15,8 +14,12 @@ class Wechat::JSAPI::Ticket
15
14
  # expires_in: 7200
16
15
  # }
17
16
  def self.create(access_token)
18
- message = ::JSONClient.new.get "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=#{access_token}&type=jsapi"
17
+
18
+ assert_present! :access_token, access_token
19
+
20
+ message = get_json "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=#{access_token}&type=jsapi"
19
21
  message.body
22
+
20
23
  end
21
24
 
22
25
  end
@@ -1,5 +1,5 @@
1
1
  module Wechat
2
2
  module JSAPI
3
- VERSION = '0.1'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = [ 'lib' ]
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.11'
30
- spec.add_development_dependency 'rake', '~> 10.0'
31
- spec.add_development_dependency 'rspec', '~> 3.0'
30
+ spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rspec', '~> 3.0'
32
32
 
33
- spec.add_dependency 'wechat-core', '~> 0.2'
33
+ spec.add_dependency 'wechat-core', '~> 0.4'
34
34
 
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat-jsapi
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-28 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.2'
61
+ version: '0.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.2'
68
+ version: '0.4'
69
69
  description: Wechat JS API Library is a wrapper for calling Wechat JS APIs. 微信社交库封装了对微信JS
70
70
  API的调用。
71
71
  email:
@@ -80,10 +80,12 @@ files:
80
80
  - CHANGELOG.md
81
81
  - CODE_OF_CONDUCT.md
82
82
  - Gemfile
83
+ - Gemfile.lock
83
84
  - LICENSE.txt
84
85
  - README.md
85
86
  - ROADMAP.md
86
87
  - Rakefile
88
+ - _config.yml
87
89
  - bin/console
88
90
  - bin/setup
89
91
  - lib/wechat/jsapi.rb
@@ -111,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
113
  version: '0'
112
114
  requirements: []
113
115
  rubyforge_project:
114
- rubygems_version: 2.4.5.1
116
+ rubygems_version: 2.6.4
115
117
  signing_key:
116
118
  specification_version: 4
117
119
  summary: Wechat JS API Library 微信JS API库