Comagic client

Installation

  1. Put this line to your Gemfile: gem 'comagic_client'
  2. Run in your console: bundle install

Usage

  1. Login:
  creds     = %w{email@example.com P455W0RD}
  connector = ComagicClient.new *creds
  connector.login
  1. Get sites:
  # Get all sites
  puts connector.site
  # Get all sites site by customer_id
  puts connector.site customer_id: 1337
  1. Get ad campaigns (acs):
    # Get all acs without site_id and customer_id specified
    puts connector.ac
    # Get all acs with site_id specified
    puts connector.ac  site_id: 1337
    # Get all acs with customer_id specified
    puts connector.ac  customer_id: 31337
    # Get all acs with site_id and customer_id specified
    puts connector.ac site_id: 1337, customer_id: 31337
  1. Get tags:
    # Get all tags with no customer_id specified
    puts connector.tag
    # Get all tags with customer_id specified
    puts connector.tag customer_id: 31337
  1. Get communications:
    # Get all communications with customer_id, site_id, date_from and date_till
    puts connector.communication site_id: 1337, customer_id: 31337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
    # Get all communications with site_id, date_from and date_till
    puts connector.communication site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get stats:
    # Get stat for site with customer_id, site_id, date_from and date_till
    puts connector.stat site_id: 1337, customer_id: 31337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
    # Get stat for site with site_id, date_from and date_till
    puts connector.stat site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get goals:
    # Get goal for site with customer_id, site_id, date_from and date_till
    puts connector.goal site_id: 1337, customer_id: 31337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
    # Get goal for site with site_id, date_from and date_till
    puts connector.goal site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get calls:
    # Get calls for site with customer_id, date_from and date_till
    puts connector.call customer_id: 31337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
    # Get calls for site with date_from and date_till
    puts connector.call  date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get chats:
    # for agency account:
    puts connector.chat customer_id: 31337, site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
    # for customer account:
    puts connector.chat site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get chat messages:
    puts connector.chat_message chat_id: 7855
  1. Get offline messages:
    # for agency accounts:
    puts connector.offline_message site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
    # for customer accounts:
    puts connector.offline_message customer_id: 31337, site_id: 1337, date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get person by visitor
    # for agency accounts:
    puts connector.person_by_visitor customer_id: 31337, id: 777
    # for customer accounts:
    puts connector.person_by_visitor id: 777
  1. Get visitors by person
    # for agency accounts:
    puts connector.visitors_by_person customer_id: 31337, id: 666
    # for customer accounts:
    puts connector.visitors_by_person id: 666
  1. Get visitor by id:
    # for agency accounts:
    puts connector.visitor customer_id: 31337, visitor_id: 777
    # for customer accounts:
    puts connector.visitor visitor_id: 777
  1. Get cdr_in by period:
    puts connector.get_cdr_in date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Get cdr_out by period:
    puts connector.get_cdr_out date_from: '2014-12-01 00:00:00', date_till: '2014-12-31 23:59:59'
  1. Create site:
    puts "create site"
    data = {}
    data[:args] = { 
      domain: 'example.com',
      user_phone: '84955555555'
    }
    puts connector.create_site data
  1. Logout:
    connector.logout