Sha256: d3e72bfb59f301899f9bff3e4273c48e8cc3e204d42b90313936552cd624e7d9

Contents?: true

Size: 683 Bytes

Versions: 12

Compression:

Stored size: 683 Bytes

Contents

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

    def initialize(response)
      @response = response
      @id = response['id']
      @valid = response['valid']
    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'
    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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
avo-0.4.10 lib/avo/app/licensing/license.rb
avo-0.4.9 lib/avo/app/licensing/license.rb
avo-0.4.8 lib/avo/app/licensing/license.rb
avo-0.4.7 lib/avo/app/licensing/license.rb
avo-0.4.6 lib/avo/app/licensing/license.rb
avo-0.4.5 lib/avo/app/licensing/license.rb
avo-0.4.4 lib/avo/app/licensing/license.rb
avo-0.4.3 lib/avo/app/licensing/license.rb
avo-0.4.2 lib/avo/app/licensing/license.rb
avo-0.4.1 lib/avo/app/licensing/license.rb
avo-0.3.2 lib/avo/app/licensing/license.rb
avo-0.3.1 lib/avo/app/licensing/license.rb