Sha256: 8a74ae8e64638098b3e35bf241ad95037e900f90987288f772a4650f6817f45a
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
module Masheri class Member < ApiObjectBase attr_reader :created, :updated attr_accessor(:username, :email, :display_name, :uri, :blog, :im, :imsvc, :phone, :company, :address1, :address2, :locality, :region, :postal_code, :country_code, :first_name, :last_name, :registration_ipaddr, :area_status, :external_id, :passwd_new) def self.create(username, display_name, email, fields = {}) fields ||= {} our_fields = fields.merge('username' => username, 'display_name' => display_name, 'email' => email) super(our_fields) end def self.fetch_all Masheri.client.call_remote("object.query", params: "SELECT * FROM members") end def self.fetch_by_username(username) Masheri.client.call_remote("object.query", params: "SELECT * FROM members WHERE username = '#{username}'") end def add_role(role_or_id) role_id = role_or_id.is_a?(Role) ? role_or_id.id : role_or_id Masheri.client.call_remote('member.addRole', {'username' => username}, {'id' => role_id}) end def remove_role(role_or_id) role_id = role_or_id.is_a?(Role) ? role_or_id.id : role_or_id Masheri.client.call_remote('member.removeRole', {'username' => username}, {'id' => role_id}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
masheri-0.3.1 | lib/masheri/member.rb |
masheri-0.2.0 | lib/masheri/member.rb |