Sha256: f1e45e2b1c257bd96170537ac944d025970ba3fc190c28635a55816d977e5064

Contents?: true

Size: 726 Bytes

Versions: 3

Compression:

Stored size: 726 Bytes

Contents

module UplandMobileCommonsRest
  class Groups < Base

    def base_path
      'groups'
    end

    def list
      resp = client.get_request(base_path)
      resp.body['response']['groups']['group']
    end

    def create(name)
      client.get_request("create_group?name=#{url_escape(name)}")
    end

    def add_member(group_id, phone_numbers)
      phone_number_argument = if phone_numbers.is_a?(Array)
                                phone_numbers.join(',')
                              else
                                phone_numbers
                              end

      client.get_request("add_group_member?group_id=#{url_escape(group_id)}&phone_number=#{url_escape(phone_number_argument)}")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
upland_mobile_commons_rest-0.1.1 lib/upland_mobile_commons_rest/groups.rb
upland_mobile_commons_rest-0.1.0 lib/upland_mobile_commons_rest/groups.rb
upland_mobile_commons_rest-0.0.1 lib/upland_mobile_commons_rest/groups.rb