Sha256: cdec5bb801eecb33d5efbb86e654811114db37654ffcbb21d121a79d4c660743

Contents?: true

Size: 853 Bytes

Versions: 5

Compression:

Stored size: 853 Bytes

Contents

module Access
  class Member

    def self.process_batch(chunk)
      chunk.map { |member| new(member) }
    end

    def initialize(values)
      self.class.class_eval {attr_reader *values.keys + [:user] }
      values.each do |attribute_name, attribute_value|
        self.instance_variable_set("@#{attribute_name}", attribute_value)
      end
      @user  =  Access::User.new(@user) if @user
      @member  = Access::Member.new(@member.tap {|m| m.delete(:user) }) if @member
      @program = Access::Program.new(@program) if @program
      @organization = Access::Organization.new(@organization) if @organization
    end

    def self.show(member_key, options = {})
      Access::Api.new.member_show member_key, options
    end

    def self.update(member_key, options = {})
      Access::Api.new.member_update member_key, options
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
access-2.0.50 lib/access/member.rb
access-2.0.49 lib/access/member.rb
access-2.0.48 lib/access/member.rb
access-2.0.47 lib/access/member.rb
access-2.0.46 lib/access/member.rb