Ruby client for retailCRM API
Go to file
2016-03-14 23:07:43 +03:00
lib fix typos 2016-03-08 01:26:58 +03:00
spec enable specs for refs 2015-07-16 18:03:57 +03:00
.gitignore fix references edit methods, fix make request to proper collect of ids & filters, referenses tests added 2015-07-16 18:01:35 +03:00
LICENSE init 2015-04-13 03:14:25 +03:00
Rakefile fix references edit methods, fix make request to proper collect of ids & filters, referenses tests added 2015-07-16 18:01:35 +03:00
README.md Update README.md 2016-03-14 23:07:43 +03:00
README.ru.md update client methods & docs 2016-03-08 01:23:25 +03:00
retailcrm.gemspec gemspec 2016-03-08 01:25:01 +03:00

Gem Version

retailCRM API ruby client

Install

gem install retailcrm

Examples

Get order

require 'retailcrm'

api = Retailcrm.new('https://yourcrmname.retailcrm.pro', 'yourApiKeyHere')

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

Create order

require 'retailcrm'

api = Retailcrm.new('https://yourcrmname.retailcrm.pro', '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).response
order_id = response[:id]

Documentation