lib/ably/models/token_details.rb in ably-0.8.15 vs lib/ably/models/token_details.rb in ably-1.0.0

- old
+ new

@@ -71,10 +71,20 @@ end # @!attribute [r] capability # @return [Hash] Capabilities assigned to this token def capability - JSON.parse(attributes.fetch(:capability)) if attributes.has_key?(:capability) + if attributes.has_key?(:capability) + capability_val = attributes.fetch(:capability) + case capability_val + when Hash + capability_val + when Ably::Models::IdiomaticRubyWrapper + capability_val.as_json + else + JSON.parse(attributes.fetch(:capability)) + end + end end # @!attribute [r] client_id # @return [String] Optional client ID assigned to this token def client_id