Sha256: 7ca5d831f42de524abe37e17fa2f88c9d5f53a0df62be732d26ffc9d3c16e12d

Contents?: true

Size: 864 Bytes

Versions: 23

Compression:

Stored size: 864 Bytes

Contents

module Avo
  module Licensing
    class License
      attr_accessor :id
      attr_accessor :response
      attr_accessor :valid
      attr_accessor :payload

      def initialize(response)
        @response = response
        @id = response["id"]
        @valid = response["valid"]
        @payload = response["payload"]
      end

      def valid?
        valid
      end

      def invalid?
        !valid?
      end

      def pro?
        id == "pro"
      end

      def error
        @response["error"]
      end

      def properties
        @response.slice("valid", "id", "error").symbolize_keys
      end

      def abilities
        []
      end

      def can(ability)
        abilities.include? ability
      end

      def cant(ability)
        !can ability
      end

      alias_method :has, :can
      alias_method :lacks, :cant
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
avo-1.4.4 lib/avo/licensing/license.rb
avo-1.4.3 lib/avo/licensing/license.rb
avo-1.4.2 lib/avo/licensing/license.rb
avo-1.4.1 lib/avo/licensing/license.rb
avo-1.4.0 lib/avo/licensing/license.rb
avo-1.4.0.pre.1 lib/avo/licensing/license.rb
avo-1.3.5 lib/avo/licensing/license.rb
avo-1.3.5.pre.1 lib/avo/licensing/license.rb
avo-1.3.4 lib/avo/licensing/license.rb
avo-1.3.3 lib/avo/licensing/license.rb
avo-1.3.2 lib/avo/licensing/license.rb
avo-1.3.1 lib/avo/licensing/license.rb
avo-1.3.0 lib/avo/licensing/license.rb
avo-1.2.11.pre.4 lib/avo/licensing/license.rb
avo-1.2.11.pre.3 lib/avo/licensing/license.rb
avo-1.2.11.pre.2 lib/avo/licensing/license.rb
avo-1.2.11.pre.1 lib/avo/licensing/license.rb
avo-1.2.10 lib/avo/licensing/license.rb
avo-1.2.9 lib/avo/licensing/license.rb
avo-1.2.8 lib/avo/licensing/license.rb