wxapi 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a96de275aacbda637fb5d2f52229cbfae165c168f7b657dd5c6608b742805e20
4
- data.tar.gz: 0e4e7d0888413af25fa4392b9f5a4b7adfabbc8782721eb6fdd900392f3f3ccc
3
+ metadata.gz: 05a6023ecbfe39cec24b74c8dbbc721c2b98d6c923a4361b2b54176ed0f1e994
4
+ data.tar.gz: c2e7cc04f2901ca7b781ec48e849acfe31a9bf8fbfc0fe09579309d1ef86e621
5
5
  SHA512:
6
- metadata.gz: 6050182becc85a57cab38778ae027fe22497a26ee33366c36c95edcb1b4736cf72f5f6ff1f42421d908a4b7d907df1259430cfe1cba38a364d6c98d1816d0b08
7
- data.tar.gz: e8522ae70f8312f1cc18b039b99e51be5e5c782ff46b7b70cb7ca0a3e16a473993fbd63f248d18e284777acb316a4f93ebbad0c3f7a8976b0322a4975ebd6074
6
+ metadata.gz: 968d5532cc49c9ad8cd66125870d7fcf0b5f459d61e25c202d1400e950d4ca0b5748a408bc924dbf4f6373cfe010976a37638f3b6b081e838c6787976dc124ed
7
+ data.tar.gz: 02d633229c61daf254424f3cc49134fd8329448fbdd744a5e2217b2388ccd631b57c0ff025df9e080474cd5e7ec2f9538a7db1caa96c5e1e28c1d73bd50fe90d
data/Gemfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wxapi (1.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ connection_pool (2.4.1)
10
+ domain_name (0.6.20240107)
11
+ http-accept (1.7.0)
12
+ http-cookie (1.0.5)
13
+ domain_name (~> 0.5)
14
+ json (2.7.1)
15
+ mime-types (3.5.2)
16
+ mime-types-data (~> 3.2015)
17
+ mime-types-data (3.2023.1205)
18
+ netrc (0.11.0)
19
+ rake (10.5.0)
20
+ redis (5.0.8)
21
+ redis-client (>= 0.17.0)
22
+ redis-client (0.19.1)
23
+ connection_pool
24
+ rest-client (2.1.0)
25
+ http-accept (>= 1.7.0, < 2.0)
26
+ http-cookie (>= 1.0.2, < 2.0)
27
+ mime-types (>= 1.16, < 4.0)
28
+ netrc (~> 0.8)
29
+ unf_ext (0.0.7.7)
30
+
31
+ PLATFORMS
32
+ ruby
33
+ x86_64-darwin-22
34
+
35
+ DEPENDENCIES
36
+ bundler
37
+ json
38
+ rake (~> 10.0)
39
+ redis
40
+ rest-client (~> 2.1)
41
+ unf_ext (~> 0.0.7.5)
42
+ wxapi!
43
+
44
+ BUNDLED WITH
45
+ 2.5.4
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
- require "bundler/gem_tasks"
1
+ #require "bundler/gem_tasks"
2
2
  task :default => :spec
3
3
 
4
4
 
5
5
  task :upload do |t|
6
- sh "gem build wxapi.gemspec"
7
- sh "gem push wxapi-#{WxApi::VERSION}.gem"
6
+ puts "Uploading not implemented"
7
+ wxApi = Wxapi.new app_id: 'wx3b8fe6d36cc00e3e'
8
+ puts wxApi.get_access_token
8
9
  end
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "wx_api"
4
+ require "wxapi"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module AccessToken
10
10
 
11
11
  ###
@@ -18,7 +18,7 @@ class WxApi
18
18
  access_token_cache = @access_token_cache
19
19
 
20
20
  unless access_token_cache
21
- response = HTTParty.get("#{prefix}/cgi-bin/token?grant_type=client_credential&appid=#{appid}&secret=#{secret}").body
21
+ response = RestClient.get("#{prefix}/cgi-bin/token?grant_type=client_credential&appid=#{appid}&secret=#{secret}").body
22
22
  response_body = (JSON.parse response)
23
23
 
24
24
  # 抛出异常
@@ -30,7 +30,7 @@ class WxApi
30
30
  _cache_key = "#{appid}_access_token"
31
31
  _cached_access_token = $redis.get _cache_key
32
32
  if _cached_access_token == nil or _cached_access_token == ''
33
- response = HTTParty.get("#{prefix}/cgi-bin/token?grant_type=client_credential&appid=#{appid}&secret=#{secret}").body
33
+ response = RestClient.get("#{prefix}/cgi-bin/token?grant_type=client_credential&appid=#{appid}&secret=#{secret}").body
34
34
  response_body = (JSON.parse response)
35
35
 
36
36
  # 抛出异常
data/lib/wxapi/account.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Account
10
10
  ###
11
11
  # 获取临时场景带惨二维码,30天有效
@@ -81,7 +81,7 @@ class WxApi
81
81
  end
82
82
 
83
83
  File.open(path, 'wb') do |f|
84
- f.write(HTTParty.get(url).body)
84
+ f.write(RestClient.get(url).body)
85
85
  end
86
86
 
87
87
  path
data/lib/wxapi/aes.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Aes
10
10
  # 解密
11
11
  def decrypt(key, dicrypted_string)
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Kf
10
10
 
11
11
  ###
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Material
10
10
  ###
11
11
  # 获得临时图片素材的 media_id
data/lib/wxapi/menu.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Menu
10
10
  ###
11
11
  # create wechat public menu
@@ -54,7 +54,7 @@ class WxApi
54
54
  def query_menu()
55
55
  # request access_token
56
56
  access_token = get_access_token()
57
- response = HTTParty.get("#{prefix}/cgi-bin/menu/get?access_token=#{access_token}").body
57
+ response = RestClient.get("#{prefix}/cgi-bin/menu/get?access_token=#{access_token}").body
58
58
  (JSON.parse response)
59
59
  end
60
60
 
@@ -65,7 +65,7 @@ class WxApi
65
65
  def delete_menu()
66
66
  # request access_token
67
67
  access_token = get_access_token
68
- response = HTTParty.get("#{prefix}/cgi-bin/menu/delete?access_token=#{access_token}").body
68
+ response = RestClient.get("#{prefix}/cgi-bin/menu/delete?access_token=#{access_token}").body
69
69
  (JSON.parse response)
70
70
  end
71
71
  end
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Tp
10
10
  ###
11
11
  # @param <JSON> message
data/lib/wxapi/user.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module User
10
10
  # 获取用户信息
11
11
  # @return <JSON>
data/lib/wxapi/utils.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Wechat number: zmx119966
6
6
  ####################################################
7
7
 
8
- class WxApi
8
+ class Wxapi
9
9
  module Utils
10
10
  # todo
11
11
  end
data/lib/wxapi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- class WxApi
2
- VERSION = "1.0.0"
1
+ class Wxapi
2
+ VERSION = "1.0.2"
3
3
  end
@@ -9,7 +9,10 @@ require "wxapi/utils"
9
9
  require "wxapi/user"
10
10
  require "wxapi/material"
11
11
 
12
- class WxApi
12
+ class Wxapi
13
+
14
+
15
+
13
16
  include AccessToken
14
17
  include Account
15
18
  include Aes
@@ -28,14 +31,14 @@ class WxApi
28
31
  #
29
32
  # api.get_access_token
30
33
  #
31
-
32
34
  attr_accessor :app_id, :app_secret, :access_token_cache
33
35
  attr_accessor :prefix
34
36
  def initialize(options={})
35
37
  @app_id = options[:app_id]
36
38
  @app_secret = options[:app_secret]
37
39
  @access_token_cache = options[:access_token_cache]
38
- @prefix = options[:api_prefix]
40
+ @prefix = options[:prefix]
39
41
  @prefix="https://api.weixin.qq.com" if @prefix.nil?
40
42
  end
43
+
41
44
  end
data/test.rb ADDED
@@ -0,0 +1,11 @@
1
+ require './lib/wxapi'
2
+ require 'redis'
3
+ require 'rest-client'
4
+ require 'json'
5
+ $redis = Redis.new(url: "redis://localhost:6379/0")
6
+ $we_api = Wxapi.new app_id: 'wx3b8fe6d36cc00e3e',
7
+ app_secret: 'e6755d03d7f58b71aac8c22f6271c265',
8
+ access_token_cache: false,
9
+ api_prefix: 'https://proxy.biying88.cn/proxywx'
10
+
11
+ puts $we_api.get_access_token
data/wxapi.gemspec CHANGED
@@ -5,7 +5,7 @@ require "wxapi/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "wxapi"
8
- spec.version = WxApi::VERSION
8
+ spec.version = Wxapi::VERSION
9
9
  spec.authors = ["黄滚 twitter: @hg_nohair"]
10
10
  spec.email = ["xurenlu@gmail.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - '黄滚 twitter: @hg_nohair'
@@ -103,12 +103,13 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - Gemfile
106
+ - Gemfile.lock
106
107
  - LICENSE.txt
107
108
  - README.md
108
109
  - Rakefile
109
110
  - bin/console
110
111
  - bin/setup
111
- - lib/wx_api.rb
112
+ - lib/wxapi.rb
112
113
  - lib/wxapi/access_token.rb
113
114
  - lib/wxapi/account.rb
114
115
  - lib/wxapi/aes.rb
@@ -119,6 +120,7 @@ files:
119
120
  - lib/wxapi/user.rb
120
121
  - lib/wxapi/utils.rb
121
122
  - lib/wxapi/version.rb
123
+ - test.rb
122
124
  - wxapi.gemspec
123
125
  homepage: https://github.com/xurenlu/wxapi
124
126
  licenses: