开源软件名称(OpenSource Name):urbanairship/ruby-library开源软件地址(OpenSource Url):https://github.com/urbanairship/ruby-library开源编程语言(OpenSource Language):Ruby 100.0%开源软件介绍(OpenSource Introduction):About
RequirementsWe officially support the following Ruby versions: 2.6.7 2.7.2 Newer 2.x versions should work as well. FunctionalityVersion 8.0 is a major upgrade, as we have changed the tested/supported versions of Ruby. A more detailed list of changes can be found in the CHANGELOG. QuestionsThe best place to ask questions or report a problem is our support site: http://support.airship.com/ InstallationIf you have the >>> $ gem 'urbanairship' And then execute: >>> $ bundle OR install it yourself as: >>> $ gem install urbanairship ConfigurationIn your app initialization, you can do something like the following: require 'urbanairship'
Urbanairship.configure do |config|
config.server = 'go.airship.eu'
config.log_path = '/path/to/your/logfile'
config.log_level = Logger::WARN
config.timeout = 60
end If you want to use a custom logger (e.g Rails.logger), you can do: require 'urbanairship'
Urbanairship.configure do |config|
config.custom_logger = Rails.logger
config.log_level = Logger::WARN
end Available Configurations
UsageOnce the gem has been installed you can start sending pushes! See the full documentation, api examples, as well as the Airship API Documentation for more information. Broadcast to All Devicesrequire 'urbanairship'
UA = Urbanairship
airship = UA::Client.new(key:'application_key', secret:'master_secret')
p = airship.create_push
p.audience = UA.all
p.notification = UA.notification(alert: 'Hello')
p.device_types = UA.device_types(['ios','android'])
p.send_push Simple Tag Pushrequire 'urbanairship'
UA = Urbanairship
airship = UA::Client.new(key:'application_key', secret:'master_secret')
p = airship.create_push
p.audience = UA.tag('some_tag')
p.notification = UA.notification(alert: 'Hello')
p.device_types = UA.device_types(['ios','android'])
p.send_push Specify the Airship server used to make your requestsBy default, the request will be sent to the 'go.urbanairship.com' server: require 'urbanairship'
Urbanairship::Client.new(key:'application_key', secret:'master_secret') You can change the server globally in the Urbanairship configuration: require 'urbanairship'
Urbanairship.configure do |config|
config.server = 'go.airship.eu'
end
Urbanairship::Client.new(key:'application_key', secret:'master_secret')
# request will be sent to the 'go.airship.eu' server Finally, you can change the targeted server on a request basis: require 'urbanairship'
Urbanairship.configure do |config|
config.server = 'go.airship.eu'
end
Urbanairship::Client.new(key:'application_key', secret:'master_secret', server: 'go.urbanairship.com')
# The Urbanairship configuration is overridden by the client and the
# request will be sent to the 'go.urbanairship.com' server Using Bearer Token Authrequire 'urbanairship'
UA = Urbanairship
airship = UA::Client.new(key:'application_key', token:'token')
# Then continue as you would otherwise Note: If you include a token in your instantiation, the request will use bearer token auth. Bearer token auth is required for some endpoints, but not supported by others. Please check the Airship docs site to see where it is supported. Contributing
7. Reach out to our support team at https://support.airship.com to let us know about your PR and your urgency level. Note: Changes will not be approved and merged without a signed contribution agreement. DevelopmentAfter checking out the repo, ensure you have >>> $ bin/setup to install dependencies. Then, run: >>> $ bin/console for an interactive prompt that will allow you to experiment. OR you can build a local gem to play with: >>> $ gem build urbanairship.gemspec >>> $ gem install ./urbanairship-<VERSION>.gem Having a local build will give you better logging if you are running into issues, but be careful to make sure to use our released public gem in Production. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论