Class: Ably::Models::Stats
- Inherits:
-
Object
- Object
- Ably::Models::Stats
- Extended by:
- Ably::Modules::Enum
- Includes:
- Ably::Modules::ModelCommon
- Defined in:
- lib/submodules/ably-ruby/lib/ably/models/stats.rb,
lib/submodules/ably-ruby/lib/ably/models/stats_types.rb
Overview
A class representing an individual statistic for a specified #interval_id
Defined Under Namespace
Classes: ConnectionTypes, IntegerDefaultZero, MessageCount, MessageTraffic, MessageTypes, RequestCount, ResourceCount, StatsStruct
Constant Summary collapse
- GRANULARITY =
ruby_enum('GRANULARITY', :minute, :hour, :day, :month )
- INTERVAL_FORMAT_STRING =
[ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ]
Instance Attribute Summary collapse
-
#all ⇒ Stats::MessageTypes
readonly
Aggregates inbound and outbound messages.
-
#api_requests ⇒ Stats::RequestCount
readonly
Breakdown of API requests received via the REST API.
-
#channels ⇒ Stats::ResourceCount
readonly
Breakdown of channels stats.
-
#connections ⇒ Stats::ConnectionTypes
readonly
Breakdown of connection stats data for different (TLS vs non-TLS) connection types.
-
#inbound ⇒ Stats::MessageTraffic
readonly
All inbound messages i.e.
-
#interval_granularity ⇒ GRANULARITY
readonly
The granularity of the interval for the stat such as :day, :hour, :minute, see GRANULARITY.
-
#interval_id ⇒ String
readonly
The interval that this statistic applies to, see GRANULARITY and INTERVAL_FORMAT_STRING.
-
#interval_time ⇒ Time
readonly
A Time object representing the start of the interval.
-
#outbound ⇒ Stats::MessageTraffic
readonly
All outbound messages i.e.
-
#persisted ⇒ Stats::MessageTypes
readonly
Messages persisted for later retrieval via the history API.
-
#token_requests ⇒ Stats::RequestCount
readonly
Breakdown of Token requests received via the REST API.
Attributes included from Ably::Modules::ModelCommon
Class Method Summary collapse
-
.from_interval_id(interval_id) ⇒ Time
Returns the UTC 0 start Time of an interval_id.
-
.granularity_from_interval_id(interval_id) ⇒ GRANULARITY
Returns the GRANULARITY determined from the interval_id.
-
.to_interval_id(time, granularity) ⇒ String
Convert a Time with the specified Granularity into an interval ID based on UTC 0 time.
Instance Method Summary collapse
- #as_json(*args) ⇒ Object
- #attributes ⇒ Object
-
#initialize(hash_object) ⇒ Stats
constructor
Stats initializer.
Methods included from Ably::Modules::ModelCommon
#==, #[], included, #to_json, #to_s
Methods included from Ably::Modules::MessagePack
Constructor Details
#initialize(hash_object) ⇒ Stats
Ably::Models::Stats initializer
118 119 120 121 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 118 def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end |
Instance Attribute Details
#all ⇒ Stats::MessageTypes (readonly)
Aggregates inbound and outbound messages
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#api_requests ⇒ Stats::RequestCount (readonly)
Breakdown of API requests received via the REST API
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#channels ⇒ Stats::ResourceCount (readonly)
Breakdown of channels stats
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#connections ⇒ Stats::ConnectionTypes (readonly)
Breakdown of connection stats data for different (TLS vs non-TLS) connection types
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#inbound ⇒ Stats::MessageTraffic (readonly)
All inbound messages i.e. received by Ably from clients
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#interval_granularity ⇒ GRANULARITY (readonly)
Returns The granularity of the interval for the stat such as :day, :hour, :minute, see GRANULARITY.
185 186 187 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 185 def interval_granularity self.class.granularity_from_interval_id(interval_id) end |
#interval_id ⇒ String (readonly)
Returns The interval that this statistic applies to, see GRANULARITY and INTERVAL_FORMAT_STRING.
173 174 175 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 173 def interval_id attributes.fetch(:interval_id) end |
#interval_time ⇒ Time (readonly)
Returns A Time object representing the start of the interval.
179 180 181 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 179 def interval_time self.class.from_interval_id(interval_id) end |
#outbound ⇒ Stats::MessageTraffic (readonly)
All outbound messages i.e. sent from Ably to clients
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#persisted ⇒ Stats::MessageTypes (readonly)
Messages persisted for later retrieval via the history API
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
#token_requests ⇒ Stats::RequestCount (readonly)
Breakdown of Token requests received via the REST API
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 37 class Stats include Ably::Modules::ModelCommon extend Ably::Modules::Enum GRANULARITY = ruby_enum('GRANULARITY', :minute, :hour, :day, :month ) INTERVAL_FORMAT_STRING = [ '%Y-%m-%d:%H:%M', '%Y-%m-%d:%H', '%Y-%m-%d', '%Y-%m' ] class << self # Convert a Time with the specified Granularity into an interval ID based on UTC 0 time # @example # Stats.to_interval_id(Time.now, :hour) # => '2015-01-01:10' # # @param time [Time] Time used to determine the interval # @param granularity [GRANULARITY] Granularity of the metrics such as :hour, :day # # @return [String] interval ID used for stats # def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end # Returns the UTC 0 start Time of an interval_id # @example # Stats.from_interval_id('2015-01-01:10') # => 2015-01-01 10:00:00 +0000 # # @param interval_id [String] # # @return [Time] start time of the provided interval_id # def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end # Returns the {GRANULARITY} determined from the interval_id # @example # Stats.granularity_from_interval_id('2015-01-01:10') # => :hour # # @param interval_id [String] # # @return [GRANULARITY] Granularity Enum for the interval_id # def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end private def expected_length(format) format.gsub('%Y', 'YYYY').length end end # {Stats} initializer # # @param hash_object [Hash] object with the underlying stat details # def initialize(hash_object) @raw_hash_object = hash_object set_attributes_object hash_object end # Aggregates inbound and outbound messages # @return {Stats::MessageTypes} def all @all ||= Stats::MessageTypes.new(attributes[:all]) end # All inbound messages i.e. received by Ably from clients # @return {Stats::MessageTraffic} def inbound @inbound ||= Stats::MessageTraffic.new(attributes[:inbound]) end # All outbound messages i.e. sent from Ably to clients # @return {Stats::MessageTraffic} def outbound @outbound ||= Stats::MessageTraffic.new(attributes[:outbound]) end # Messages persisted for later retrieval via the history API # @return {Stats::MessageTypes} def persisted @persisted ||= Stats::MessageTypes.new(attributes[:persisted]) end # Breakdown of connection stats data for different (TLS vs non-TLS) connection types # @return {Stats::ConnectionTypes} def connections @connections ||= Stats::ConnectionTypes.new(attributes[:connections]) end # Breakdown of channels stats # @return {Stats::ResourceCount} def channels @channels ||= Stats::ResourceCount.new(attributes[:channels]) end # Breakdown of API requests received via the REST API # @return {Stats::RequestCount} def api_requests @api_requests ||= Stats::RequestCount.new(attributes[:api_requests]) end # Breakdown of Token requests received via the REST API # @return {Stats::RequestCount} def token_requests @token_requests ||= Stats::RequestCount.new(attributes[:token_requests]) end # @!attribute [r] interval_id # @return [String] The interval that this statistic applies to, see {GRANULARITY} and {INTERVAL_FORMAT_STRING} def interval_id attributes.fetch(:interval_id) end # @!attribute [r] interval_time # @return [Time] A Time object representing the start of the interval def interval_time self.class.from_interval_id(interval_id) end # @!attribute [r] interval_granularity # @return [GRANULARITY] The granularity of the interval for the stat such as :day, :hour, :minute, see {GRANULARITY} def interval_granularity self.class.granularity_from_interval_id(interval_id) end def attributes @attributes end def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end private def raw_hash_object @raw_hash_object end def set_attributes_object(new_attributes) @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze) end end |
Class Method Details
.from_interval_id(interval_id) ⇒ Time
Returns the UTC 0 start Time of an interval_id
82 83 84 85 86 87 88 89 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 82 def from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format Time.strptime("#{interval_id} +0000", "#{format} %z").utc end |
.granularity_from_interval_id(interval_id) ⇒ GRANULARITY
Returns the GRANULARITY determined from the interval_id
99 100 101 102 103 104 105 106 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 99 def granularity_from_interval_id(interval_id) raise ArgumentError, 'Interval ID must be a string' unless interval_id.kind_of?(String) format = INTERVAL_FORMAT_STRING.find { |fmt| expected_length(fmt) == interval_id.length } raise ArgumentError, 'Interval ID is an invalid length' unless format GRANULARITY[INTERVAL_FORMAT_STRING.index(format)] end |
.to_interval_id(time, granularity) ⇒ String
Convert a Time with the specified Granularity into an interval ID based on UTC 0 time
65 66 67 68 69 70 71 72 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 65 def to_interval_id(time, granularity) raise ArgumentError, 'Time object required as first argument' unless time.kind_of?(Time) granularity = GRANULARITY(granularity) format = INTERVAL_FORMAT_STRING[granularity.to_i] time.utc.strftime(format) end |
Instance Method Details
#as_json(*args) ⇒ Object
193 194 195 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 193 def as_json(*args) attributes.as_json(*args).reject { |key, val| val.nil? } end |
#attributes ⇒ Object
189 190 191 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 189 def attributes @attributes end |