Ruby client for retailCRM API
Go to file
Alex Lushpai 367c190b11 badge
2015-04-13 03:19:04 +03:00
lib init 2015-04-13 03:14:25 +03:00
test init 2015-04-13 03:14:25 +03:00
.gitignore init 2015-04-13 03:14:25 +03:00
LICENSE init 2015-04-13 03:14:25 +03:00
Rakefile init 2015-04-13 03:14:25 +03:00
README.md badge 2015-04-13 03:19:04 +03:00
retailcrm.gemspec init 2015-04-13 03:14:25 +03:00

Gem Version

Ruby-клиент для retailCRM API

Установка

gem install retailcrm

Примеры использования

Получение информации о заказе

require 'retailcrm'

api = Retailcrm.new('https://yourcrmname.intarocrm.ru', 'yourApiKeyHere')

response = api.orders_get(345, 'id').get_response
order = response[:order]

Создание заказа

require 'retailcrm'

api = Retailcrm.new('https://yourcrmname.intarocrm.ru', 'yourApiKeyHere')

order = {
  :externalId => 171,
  :number => '171',
  :email => 'test@example.com',
  :createdAt => '2014-10-28 19:31:10',
  :discountPercent => 10,
  :firstName => 'Jack',
  :lastName => 'Daniels',
  :customer => {
    :externalId => 8768,
    :firstName => 'Jack',
    :lastName => 'Daniels',
    :phones => [{ :number => '+79000000000' }],
  },
  :delivery => {
    :code => 'courier',
    :cost => 500,
    :address => {:text => '300000, Russia, Moscow, Tverskaya st., 56'}
  },
  :items => [
    {
      :productId => 170,
      :initialPrice => 500,
      :quantity => 2
    },
    {
      :productId => 175,
      :initialPrice => 1300,
      :quantity => 1
    }
  ]
}

response = api.orders_create(order).get_response
order_id = response[:id]

REST API Documentation

http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3