wechat_public 0.0.2 → 0.0.3
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 +4 -4
 - data/lib/wechat_public/version.rb +1 -1
 - data/lib/wechat_public.rb +18 -14
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9a70faf6c427c6b959d3d10e1440afca10b0254f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7170de0805d3978e4558405c5d9fc18a58dc7078
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 32b47dcd1e9a3325f884663fc5277dee0b4eb0bf439c394f01983c264ed17d23c642e9ec3d3db19d2095d2f548d273476af531e6394ce54f8b786d1741765953
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 459234e0052c501bbcad51fa19bb4ae597a9d37f658c871718cea5d864e503aa4f1ececb44e80101389a7369f4489378e85b44e4a91ac43bee00b820dea40c10
         
     | 
    
        data/lib/wechat_public.rb
    CHANGED
    
    | 
         @@ -30,24 +30,28 @@ module WechatPublic 
     | 
|
| 
       30 
30 
     | 
    
         
             
                  puts config
         
     | 
| 
       31 
31 
     | 
    
         
             
                  OpenStruct.new(config)
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                if defined? ActionController::Base
         
     | 
| 
      
 35 
     | 
    
         
            +
                  class ActionController::Base
         
     | 
| 
      
 36 
     | 
    
         
            +
                    def self.wechat_responder opts={}
         
     | 
| 
      
 37 
     | 
    
         
            +
                      self.send(:include, WechatPublic::Responder)
         
     | 
| 
      
 38 
     | 
    
         
            +
                      if (opts.empty?)
         
     | 
| 
      
 39 
     | 
    
         
            +
                        self.wechat = WechatPublic.api
         
     | 
| 
      
 40 
     | 
    
         
            +
                        self.token = WechatPublic.config.token
         
     | 
| 
      
 41 
     | 
    
         
            +
                      else
         
     | 
| 
      
 42 
     | 
    
         
            +
                        self.wechat = WechatPublic::Api.new(opts[:appid], opts[:secret], opts[:access_token])
         
     | 
| 
      
 43 
     | 
    
         
            +
                        self.token = opts[:token]
         
     | 
| 
      
 44 
     | 
    
         
            +
                      end
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
       33 
48 
     | 
    
         
             
              end
         
     | 
| 
       34 
49 
     | 
    
         | 
| 
       35 
50 
     | 
    
         
             
              def self.api
         
     | 
| 
       36 
51 
     | 
    
         
             
                @api ||= WechatPublic::Api.new(self.config.appid, self.config.secret, self.config.access_token)
         
     | 
| 
       37 
52 
     | 
    
         
             
              end
         
     | 
| 
       38 
     | 
    
         
            -
            end
         
     | 
| 
       39 
53 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
              class ActionController::Base
         
     | 
| 
       42 
     | 
    
         
            -
                def self.wechat_responder opts={}
         
     | 
| 
       43 
     | 
    
         
            -
                  self.send(:include, WechatPublic::Responder)
         
     | 
| 
       44 
     | 
    
         
            -
                  if (opts.empty?)
         
     | 
| 
       45 
     | 
    
         
            -
                    self.wechat = WechatPublic.api
         
     | 
| 
       46 
     | 
    
         
            -
                    self.token = WechatPublic.config.token
         
     | 
| 
       47 
     | 
    
         
            -
                  else
         
     | 
| 
       48 
     | 
    
         
            -
                    self.wechat = WechatPublic::Api.new(opts[:appid], opts[:secret], opts[:access_token])
         
     | 
| 
       49 
     | 
    
         
            -
                    self.token = opts[:token]
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
                end
         
     | 
| 
       52 
     | 
    
         
            -
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       53 
55 
     | 
    
         
             
            end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     |