Sha256: be8ccd1a671e819be668eec3ab1c1b8f25bc0b5a95f5249e611df19bd97e4d26

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

module Ucpaas
  # sms client api
  module Manage
    def find_or_create_client(app_id, mobile, options = {})
      mob = mobile.gsub(/^\+?86/, '')
      client_info = get('/ClientsByMobile', appId: app_id, mobile: mob)
      return client_info['resp']['client'] if client_info['resp']['client']
      params = {
        appId: app_id,
        clientType: 0,
        mobile: mob
      }.merge(options)
      new_client = post('/Clients', params)
      new_client['resp']['client']
    end

    def clients(app_id, start = 0, limit = 10)
      params = {
        client: {
          appId: app_id,
          start: start,
          limit: limit
        }
      }
      response = post('/clientList', params)
      response['resp']['client']
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ucpaas-0.1.3 lib/ucpaas/manage.rb
ucpaas-0.1.2 lib/ucpaas/manage.rb