lib/ably/rest/client.rb in ably-0.7.5 vs lib/ably/rest/client.rb in ably-0.7.6
- old
+ new
@@ -68,11 +68,11 @@
# Creates a {Ably::Rest::Client Rest Client} and configures the {Ably::Auth} object for the connection.
#
# @param [Hash,String] options an options Hash used to configure the client and the authentication, or String with an API key or Token ID
# @option options (see Ably::Auth#authorise)
# @option options [Boolean] :tls TLS is used by default, providing a value of false disables TLS. Please note Basic Auth is disallowed without TLS as secrets cannot be transmitted over unsecured connections.
- # @option options [String] :api_key API key comprising the key ID and key secret in a single string
+ # @option options [String] :key API key comprising the key ID and key secret in a single string
# @option options [Boolean] :use_token_auth Will force Basic Auth if set to false, and TOken auth if set to true
# @option options [String] :environment Specify 'sandbox' when testing the client library against an alternate Ably environment
# @option options [Symbol] :protocol Protocol used to communicate with Ably, :json and :msgpack currently supported. Defaults to :msgpack
# @option options [Boolean] :use_binary_protocol Protocol used to communicate with Ably, defaults to true and uses MessagePack protocol. This option will overide :protocol option
# @option options [Logger::Severity,Symbol] :log_level Log level for the standard Logger that outputs to STDOUT. Defaults to Logger::ERROR, can be set to :fatal (Logger::FATAL), :error (Logger::ERROR), :warn (Logger::WARN), :info (Logger::INFO), :debug (Logger::DEBUG) or :none
@@ -87,19 +87,19 @@
# @example
# # create a new client authenticating with basic auth
# client = Ably::Rest::Client.new('key.id:secret')
#
# # create a new client and configure a client ID used for presence
- # client = Ably::Rest::Client.new(api_key: 'key.id:secret', client_id: 'john')
+ # client = Ably::Rest::Client.new(key: 'key.id:secret', client_id: 'john')
#
def initialize(options, &token_request_block)
raise ArgumentError, 'Options Hash is expected' if options.nil?
options = options.clone
if options.kind_of?(String)
options = if options.match(/^[\w]{2,}\.[\w]{2,}:[\w]{2,}$/)
- { api_key: options }
+ { key: options }
else
{ token_id: options }
end
end
@@ -150,21 +150,21 @@
# @option options [Integer,Time] :end Time or millisecond since epoch
# @option options [Symbol] :direction `:forwards` or `:backwards`
# @option options [Integer] :limit Maximum number of stats to retrieve up to 10,000
# @option options [Symbol] :by `:minute`, `:hour`, `:day` or `:month`. Defaults to `:minute`
#
- # @return [Ably::Models::PaginatedResource<Ably::Models::Stat>] An Array of Stats
+ # @return [Ably::Models::PaginatedResource<Ably::Models::Stats>] An Array of Stats
#
def stats(options = {})
options = {
:direction => :forwards,
:by => :minute
}.merge(options)
[:start, :end].each { |option| options[option] = as_since_epoch(options[option]) if options.has_key?(option) }
paginated_options = {
- coerce_into: 'Ably::Models::Stat'
+ coerce_into: 'Ably::Models::Stats'
}
url = '/stats'
response = get(url, options)