Sha256: b90698ccf7e92ed238f13cb0b9957a50271b771e34b7b1946eadb9a3868ddd29

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

module Yao::Resources
  class User < Base
    friendly_attributes :name, :email, :enabled, :id

    alias enabled? enabled

    self.service        = "identity"
    self.resource_name  = "user"
    self.resources_name = "users"
    self.admin          = true

    class << self
      def find_by_name(name, query={})
        if api_verion_v2?
          [super]
        else
          super
        end
      end

      def return_single_on_querying
        api_verion_v2?
      end

      private
      def api_verion_v2?
        client.url_prefix.to_s.match?(/v2\.0/)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yao-0.9.0 lib/yao/resources/user.rb
yao-0.8.0 lib/yao/resources/user.rb