Sha256: 75ea43f2b00fcf229d4c71f2bd2d52c640895ba5ff62a45dacfaab8dd61bf727

Contents?: true

Size: 533 Bytes

Versions: 13

Compression:

Stored size: 533 Bytes

Contents

module Ahub
  class Group
    include Ahub::APIResource

    def add(user_id)
      add_user(user_id)
    end

    def self.find_by_name(group_name)
      matches = find_all
      matches.find{|group| group.name.downcase.strip == group_name.downcase.strip}
    end

    def add_user(user_id)
      raise Exception("No Group Id") unless id

      move_url = "#{self.class.base_url}/#{id}/add.json?users=#{user_id}"
      RestClient.put("#{move_url}", self.class.admin_headers)
      true
    rescue => e
      false
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ahub-0.11.3 lib/ahub/group.rb
ahub-0.11.2 lib/ahub/group.rb
ahub-0.11.1 lib/ahub/group.rb
ahub-0.11.0 lib/ahub/group.rb
ahub-0.10.0 lib/ahub/group.rb
ahub-0.9.0 lib/ahub/group.rb
ahub-0.8.0 lib/ahub/group.rb
ahub-0.7.0 lib/ahub/group.rb
ahub-0.6.0 lib/ahub/group.rb
ahub-0.5.2 lib/ahub/group.rb
ahub-0.5.1 lib/ahub/group.rb
ahub-0.5.0 lib/ahub/group.rb
ahub-0.4.0 lib/ahub/group.rb