Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/rongcloud. To experiment with that code, run bin/console for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
Add this line to your application's Gemfile:
gem 'rongcloud'And then execute:
$ bundle
Or install it yourself as:
$ gem install rongcloud
Rongcloud.app_key = 'YOUR_APPKEY' #融云APPKEY
Rongcloud.app_secret = 'YOUR_SECRET' #融云APP_SECRET user = Rongcloud::Service::User.new
user.user_id = 2
user.name = 'RONGYUN_USERNAME'
user.portrait_uri = 'http://tp1.sinaimg.cn/1611305952/180/5683416585/1'
user.get_token
user.token
# => adfasdfwere=23/wrewelwerwe==werw user = Rongcloud::Service::User.new
user.user_id = 2
user.name = 'RONGYUN_USERNAME'
user.portrait_uri = 'http://tp1.sinaimg.cn/1611305952/180/5683416585/1'
user.refresh
# => true model = Rongcloud::Service::Message.new
model.from_user_id = 2
model.to_user_id = 1
model.object_name = 'RC:TxtMsg'
txt_msg = Rongcloud::Service::RCTxtMsg.new
txt_msg.content = 'good job'
txt_msg.extra = 'hello extra'
model.private_publish txt_msg
# => true model = Rongcloud::Service::Message.new
sync_msg = ->(date_str) do
('00'..'23').to_a.each { |h|
history = model.history("#{date_str}#{h}")
if history[:code]==200 && history[:url] && history[:url].include?('http')
system(" curl -o tmp/#{history[:date]}.zip #{history[:url]}")
system(" unzip -o tmp/#{history[:date]}.zip -d tmp/")
end
history[:code] # => true
}
end
sync_msg.call(Time.now.strftime('%Y%m%d'))
sync_msg.call(DateTime.parse((Time.now.to_time-24*60*60).to_s).strftime('%Y%m%d'))After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.
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 to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
- Fork it ( https://github.com/[my-github-username]/rongcloud/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request