Git Product home page Git Product logo

xiaomi-push's People

Contributors

icyleaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xiaomi-push's Issues

xiaomi推送不成功,原因是缺少必要的参数?

我下载了这个包到本地,然后在push.rb 里面按照示例写了一个demo,但是缺少必要的
Must input one of: regid/topic/alias

push.rb

require 'xiaomi/push/version'
require 'xiaomi/push/error'
require 'xiaomi/push/const'
require 'xiaomi/push/client'

require 'xiaomi/push/devices/ios'
require 'xiaomi/push/devices/android'

require 'xiaomi/push/services/message'
require 'xiaomi/push/services/topic'
require 'xiaomi/push/services/feedback'

puts client_android = Xiaomi::Push::Android.new('ddddddd')
client_android.use_production!
message_android = Xiaomi::Push::Message::Android.new(
  title:'标题要有吸引力',
  description:'描述可以在手机显示两行',
  notify_type:'DEFAULT_ALL',
  extras: {
    source: 'mpush'
  }
)

puts client_android.message.send({alias:'xxxxx', message: message_android})

xiaomi返回的错误信息:

#<Xiaomi::Push::Android:0x007fa3526c6e78>
{"result"=>"error", "reason"=>"Must input one of: regid/topic/alias", "trace_id"=>"Xlm57b34466136027247wT", "code"=>21305, "description"=>"缺少必要的参数"}

/Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- dotenv (LoadError)

和rails 的gemfile 一起安装,之后运行rails s会报错如下:

/Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- dotenv (LoadError)
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/xiaomi-push-0.2.3/lib/xiaomi/push.rb:14:in `<top (required)>'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/bundler-1.8.3/lib/bundler/runtime.rb:85:in `require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/bundler-1.8.3/lib/bundler/runtime.rb:85:in `rescue in block in require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/bundler-1.8.3/lib/bundler/runtime.rb:68:in `block in require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/bundler-1.8.3/lib/bundler/runtime.rb:61:in `each'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/bundler-1.8.3/lib/bundler/runtime.rb:61:in `require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/bundler-1.8.3/lib/bundler.rb:134:in `require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus/rails.rb:97:in `default_bundle'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus.rb:200:in `run_action'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus.rb:74:in `block (2 levels) in boot_steps'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus/load_tracking.rb:7:in `features_loaded_by'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus.rb:73:in `block in boot_steps'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus.rb:56:in `catch'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus.rb:56:in `boot_steps'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/zeus-0.15.4/lib/zeus.rb:48:in `go'

需要手动加入 'dotenv' 到gemfile里

program version required (Commander::Runner::CommandError)

If I run with following command:

xmp message --device android --secret '********' -i 'biao' -d 'adasd'

will throw error:

/Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/commander-4.3.5/lib/commander/runner.rb:391:in `block in require_program': program version required (Commander::Runner::CommandError)
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/commander-4.3.5/lib/commander/runner.rb:390:in `each'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/commander-4.3.5/lib/commander/runner.rb:390:in `require_program'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/commander-4.3.5/lib/commander/runner.rb:52:in `run!'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/commander-4.3.5/lib/commander/import.rb:5:in `block in <top (required)>'
/Users/tangmonk/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- dotenv (LoadError)
    from /Users/tangmonk/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/xiaomi-push-0.2.1/lib/xiaomi/push.rb:15:in `<top (required)>'
    from /Users/tangmonk/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /Users/tangmonk/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/gems/xiaomi-push-0.2.1/bin/xmp:6:in `<top (required)>'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/bin/xmp:23:in `load'
    from /Users/tangmonk/.rvm/gems/ruby-2.1.5/bin/xmp:23:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.