mirror of
https://github.com/retailcrm/api-client-ruby.git
synced 2024-11-21 20:46:04 +03:00
Update product name, cleanup annotations
This commit is contained in:
parent
30999696f9
commit
979d06550a
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2013 Alex Lushpai
|
Copyright (c) 2013-2020 RetailDriver LLC
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
15
README.md
15
README.md
@ -1,7 +1,7 @@
|
|||||||
[![Gem](https://img.shields.io/gem/v/retailcrm?color=red&style=flat-square)](https://rubygems.org/gems/retailcrm)
|
[![Gem](https://img.shields.io/gem/v/retailcrm?color=red)](https://rubygems.org/gems/retailcrm)
|
||||||
[![RDoc](https://img.shields.io/badge/RDoc-reference-red.svg?style=flat-square)](http://www.rubydoc.info/gems/retailcrm)
|
[![RDoc](https://img.shields.io/badge/RDoc-reference-red.svg)](http://www.rubydoc.info/gems/retailcrm)
|
||||||
|
|
||||||
retailCRM API ruby client
|
RetailCRM API ruby client
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ gem install retailcrm
|
|||||||
```ruby
|
```ruby
|
||||||
require 'retailcrm'
|
require 'retailcrm'
|
||||||
|
|
||||||
api = Retailcrm.new('https://yourcrmname.retailcrm.pro', 'yourApiKeyHere')
|
api = Retailcrm.new('https://demo.retailcrm.pro', 'yourApiKeyHere')
|
||||||
|
|
||||||
response = api.orders_get(345, 'id').response
|
response = api.orders_get(345, 'id').response
|
||||||
order = response[:order]
|
order = response[:order]
|
||||||
@ -30,7 +30,7 @@ order = response[:order]
|
|||||||
```ruby
|
```ruby
|
||||||
require 'retailcrm'
|
require 'retailcrm'
|
||||||
|
|
||||||
api = Retailcrm.new('https://yourcrmname.retailcrm.pro', 'yourApiKeyHere')
|
api = Retailcrm.new('https://demo.retailcrm.pro', 'yourApiKeyHere')
|
||||||
|
|
||||||
order = {
|
order = {
|
||||||
:externalId => 171,
|
:externalId => 171,
|
||||||
@ -69,8 +69,3 @@ response = api.orders_create(order).response
|
|||||||
order_id = response[:id]
|
order_id = response[:id]
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
* [English](https://help.retailcrm.pro/Developers)
|
|
||||||
* [Russian](https://help.retailcrm.ru/Developers)
|
|
||||||
|
78
README.ru.md
78
README.ru.md
@ -1,78 +0,0 @@
|
|||||||
[![Gem Version](https://badge.fury.io/rb/retailcrm.svg)](http://badge.fury.io/rb/retailcrm)
|
|
||||||
|
|
||||||
Ruby-клиент для retailCRM API
|
|
||||||
=============================
|
|
||||||
|
|
||||||
|
|
||||||
### Установка
|
|
||||||
|
|
||||||
```
|
|
||||||
gem install retailcrm
|
|
||||||
```
|
|
||||||
|
|
||||||
### Примеры использования
|
|
||||||
|
|
||||||
#### Получение информации о заказе
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
require 'retailcrm'
|
|
||||||
|
|
||||||
api = Retailcrm.new('https://yourcrmname.retailcrm.ru', 'yourApiKeyHere')
|
|
||||||
|
|
||||||
response = api.orders_get(345, 'id').response
|
|
||||||
order = response[:order]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Создание заказа
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
require 'retailcrm'
|
|
||||||
|
|
||||||
api = Retailcrm.new('https://yourcrmname.retailcrm.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).response
|
|
||||||
order_id = response[:id]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Документация REST API
|
|
||||||
|
|
||||||
http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
|
|
||||||
#### Документация API библиотеки
|
|
||||||
|
|
||||||
http://www.rubydoc.info/gems/retailcrm
|
|
@ -24,7 +24,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get orders by filter
|
# === Get orders by filter
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders({:email => 'test@example.com', :status => 'new'}, 50, 2)
|
# >> Retailcrm.orders({:email => 'test@example.com', :status => 'new'}, 50, 2)
|
||||||
@ -44,7 +43,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get orders statuses
|
# === Get orders statuses
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_statuses([26120, 19282])
|
# >> Retailcrm.orders_statuses([26120, 19282])
|
||||||
@ -60,7 +58,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get orders by id (or externalId)
|
# === Get orders by id (or externalId)
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_get(345, 'id')
|
# >> Retailcrm.orders_get(345, 'id')
|
||||||
@ -81,7 +78,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Create order
|
# === Create order
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_create(order)
|
# >> Retailcrm.orders_create(order)
|
||||||
@ -99,7 +95,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit order
|
# === Edit order
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_edit(order)
|
# >> Retailcrm.orders_edit(order)
|
||||||
@ -118,7 +113,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Upload orders
|
# === Upload orders
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_upload(orders)
|
# >> Retailcrm.orders_upload(orders)
|
||||||
@ -136,7 +130,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Set external ids for orders created into CRM
|
# === Set external ids for orders created into CRM
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_fix_external_ids([{:id => 200, :externalId => 334}, {:id => 201, :externalId => 364}])
|
# >> Retailcrm.orders_fix_external_ids([{:id => 200, :externalId => 334}, {:id => 201, :externalId => 364}])
|
||||||
@ -152,7 +145,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get orders history
|
# === Get orders history
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.orders_history('2015-04-10 22:23:12', '2015-04-10 23:33:12')
|
# >> Retailcrm.orders_history('2015-04-10 22:23:12', '2015-04-10 23:33:12')
|
||||||
@ -176,7 +168,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get customers by filter
|
# === Get customers by filter
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.customers({:email => 'test@example.com'}, 50, 2)
|
# >> Retailcrm.customers({:email => 'test@example.com'}, 50, 2)
|
||||||
@ -196,7 +187,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get customers by id (or externalId)
|
# === Get customers by id (or externalId)
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.customers_get(345, 'id')
|
# >> Retailcrm.customers_get(345, 'id')
|
||||||
@ -217,7 +207,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Create customer
|
# === Create customer
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.customer_create(customer)
|
# >> Retailcrm.customer_create(customer)
|
||||||
@ -235,7 +224,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit customer
|
# === Edit customer
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.customers_edit(customer)
|
# >> Retailcrm.customers_edit(customer)
|
||||||
@ -254,7 +242,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Upload customers
|
# === Upload customers
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.customers_upload(customers)
|
# >> Retailcrm.customers_upload(customers)
|
||||||
@ -272,7 +259,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Set external ids for customers created into CRM
|
# === Set external ids for customers created into CRM
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.customers_fix_external_ids([{:id => 200, :externalId => 334}, {:id => 201, :externalId => 364}])
|
# >> Retailcrm.customers_fix_external_ids([{:id => 200, :externalId => 334}, {:id => 201, :externalId => 364}])
|
||||||
@ -288,7 +274,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get purchace prices & stock balance
|
# === Get purchace prices & stock balance
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.store_inventories({:productExternalId => 26120, :details => 1}, 50, 2)
|
# >> Retailcrm.store_inventories({:productExternalId => 26120, :details => 1}, 50, 2)
|
||||||
@ -308,7 +293,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Set purchace prices & stock balance
|
# === Set purchace prices & stock balance
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.store_inventories_upload({:offers => [{:externalId => 123, :stores => [{:code => 'store_1', :available => 15, :purchasePrice => 1000}]}]}, :site => 'main_site')
|
# >> Retailcrm.store_inventories_upload({:offers => [{:externalId => 123, :stores => [{:code => 'store_1', :available => 15, :purchasePrice => 1000}]}]}, :site => 'main_site')
|
||||||
@ -326,7 +310,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get packs by filter
|
# === Get packs by filter
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.packs({:store => 'main'}, 50, 2)
|
# >> Retailcrm.packs({:store => 'main'}, 50, 2)
|
||||||
@ -346,7 +329,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Create pack
|
# === Create pack
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.packs_create(pack)
|
# >> Retailcrm.packs_create(pack)
|
||||||
@ -364,7 +346,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get orders assembly history
|
# === Get orders assembly history
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.packs_history({:orderId => 26120, :startDate => '2015-04-10 23:33:12'}, 50, 2)
|
# >> Retailcrm.packs_history({:orderId => 26120, :startDate => '2015-04-10 23:33:12'}, 50, 2)
|
||||||
@ -384,7 +365,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get pack by id
|
# === Get pack by id
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.packs_get(345)
|
# >> Retailcrm.packs_get(345)
|
||||||
@ -401,7 +381,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit pack
|
# === Edit pack
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.packs_edit(pack)
|
# >> Retailcrm.packs_edit(pack)
|
||||||
@ -420,7 +399,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Delete pack
|
# === Delete pack
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# >> Retailcrm.packs_delete(14)
|
# >> Retailcrm.packs_delete(14)
|
||||||
@ -437,7 +415,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get delivery services
|
# === Get delivery services
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def delivery_services
|
def delivery_services
|
||||||
url = "#{@url}reference/delivery-services"
|
url = "#{@url}reference/delivery-services"
|
||||||
@ -446,7 +423,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit delivery service
|
# === Edit delivery service
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def delivery_services_edit(delivery_service)
|
def delivery_services_edit(delivery_service)
|
||||||
code = delivery_service[:code]
|
code = delivery_service[:code]
|
||||||
@ -456,7 +432,6 @@ class Retailcrm
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Get delivery types
|
# Get delivery types
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def delivery_types
|
def delivery_types
|
||||||
url = "#{@url}reference/delivery-types"
|
url = "#{@url}reference/delivery-types"
|
||||||
@ -465,7 +440,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit delivery type
|
# === Edit delivery type
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def delivery_types_edit(delivery_type)
|
def delivery_types_edit(delivery_type)
|
||||||
code = delivery_type[:code]
|
code = delivery_type[:code]
|
||||||
@ -476,7 +450,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get order methods
|
# === Get order methods
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def order_methods
|
def order_methods
|
||||||
url = "#{@url}reference/order-methods"
|
url = "#{@url}reference/order-methods"
|
||||||
@ -485,7 +458,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit order method
|
# === Edit order method
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def order_methods_edit(order_method)
|
def order_methods_edit(order_method)
|
||||||
code = order_method[:code]
|
code = order_method[:code]
|
||||||
@ -496,7 +468,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get order types
|
# === Get order types
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def order_types
|
def order_types
|
||||||
url = "#{@url}reference/order-types"
|
url = "#{@url}reference/order-types"
|
||||||
@ -505,7 +476,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit order type
|
# === Edit order type
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def order_types_edit(order_type)
|
def order_types_edit(order_type)
|
||||||
code = order_type[:code]
|
code = order_type[:code]
|
||||||
@ -515,7 +485,6 @@ class Retailcrm
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Get payment statuses
|
# Get payment statuses
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def payment_statuses
|
def payment_statuses
|
||||||
url = "#{@url}reference/payment-statuses"
|
url = "#{@url}reference/payment-statuses"
|
||||||
@ -524,7 +493,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit payment status
|
# === Edit payment status
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def payment_statuses_edit(payment_status)
|
def payment_statuses_edit(payment_status)
|
||||||
code = payment_status[:code]
|
code = payment_status[:code]
|
||||||
@ -535,7 +503,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get payment types
|
# === Get payment types
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def payment_types
|
def payment_types
|
||||||
url = "#{@url}reference/payment-types"
|
url = "#{@url}reference/payment-types"
|
||||||
@ -544,7 +511,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit payment type
|
# === Edit payment type
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def payment_types_edit(payment_type)
|
def payment_types_edit(payment_type)
|
||||||
code = payment_type[:code]
|
code = payment_type[:code]
|
||||||
@ -555,7 +521,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get product statuses
|
# === Get product statuses
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def product_statuses
|
def product_statuses
|
||||||
url = "#{@url}reference/product-statuses"
|
url = "#{@url}reference/product-statuses"
|
||||||
@ -564,7 +529,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit product status
|
# === Edit product status
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def product_statuses_edit(product_status)
|
def product_statuses_edit(product_status)
|
||||||
code = product_status[:code]
|
code = product_status[:code]
|
||||||
@ -574,7 +538,6 @@ class Retailcrm
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Get sites list
|
# Get sites list
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def sites
|
def sites
|
||||||
url = "#{@url}reference/sites"
|
url = "#{@url}reference/sites"
|
||||||
@ -583,7 +546,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit site
|
# === Edit site
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def sites_edit(site)
|
def sites_edit(site)
|
||||||
code = site[:code]
|
code = site[:code]
|
||||||
@ -594,7 +556,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get status groups
|
# === Get status groups
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def status_groups
|
def status_groups
|
||||||
url = "#{@url}reference/status-groups"
|
url = "#{@url}reference/status-groups"
|
||||||
@ -602,7 +563,6 @@ class Retailcrm
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Get statuses
|
# Get statuses
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def statuses
|
def statuses
|
||||||
url = "#{@url}reference/statuses"
|
url = "#{@url}reference/statuses"
|
||||||
@ -611,7 +571,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit status
|
# === Edit status
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def statuses_edit(status)
|
def statuses_edit(status)
|
||||||
code = status[:code]
|
code = status[:code]
|
||||||
@ -622,7 +581,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Get stores
|
# === Get stores
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def stores
|
def stores
|
||||||
url = "#{@url}reference/stores"
|
url = "#{@url}reference/stores"
|
||||||
@ -631,7 +589,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Edit store
|
# === Edit store
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def stores_edit(store)
|
def stores_edit(store)
|
||||||
code = store[:code]
|
code = store[:code]
|
||||||
@ -641,7 +598,6 @@ class Retailcrm
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Get countries list
|
# Get countries list
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def countries
|
def countries
|
||||||
url = "#{@url}reference/countries"
|
url = "#{@url}reference/countries"
|
||||||
@ -650,7 +606,6 @@ class Retailcrm
|
|||||||
|
|
||||||
##
|
##
|
||||||
# === Statistic update
|
# === Statistic update
|
||||||
# http://www.retailcrm.ru/docs/Developers/ApiVersion3
|
|
||||||
#
|
#
|
||||||
def statistic_update
|
def statistic_update
|
||||||
url = "#{@url}statistic/update"
|
url = "#{@url}statistic/update"
|
||||||
|
@ -5,7 +5,7 @@ class Bootstrap
|
|||||||
attr_reader :api_key, :api_url, :order, :customer, :refs_get, :refs_edit
|
attr_reader :api_key, :api_url, :order, :customer, :refs_get, :refs_edit
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@api_url = 'https://demo.retailcrm.ru'
|
@api_url = 'https://demo.retailcrm.pro'
|
||||||
@api_key = 'YourAPIKeyRightHere'
|
@api_key = 'YourAPIKeyRightHere'
|
||||||
|
|
||||||
id = Time.now.to_i
|
id = Time.now.to_i
|
||||||
@ -14,9 +14,9 @@ class Bootstrap
|
|||||||
@customer = {
|
@customer = {
|
||||||
:externalId => id,
|
:externalId => id,
|
||||||
:createdAt => time,
|
:createdAt => time,
|
||||||
:firstName => 'API',
|
:firstName => 'John',
|
||||||
:lastName => 'Test',
|
:lastName => 'Doe',
|
||||||
:email => 'pupkin@example.org',
|
:email => 'john@example.org',
|
||||||
:phones => [{:number => '+79099099090'}]
|
:phones => [{:number => '+79099099090'}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,24 +31,23 @@ class Bootstrap
|
|||||||
:firstName => 'API',
|
:firstName => 'API',
|
||||||
:lastName => 'Test',
|
:lastName => 'Test',
|
||||||
:customer => {
|
:customer => {
|
||||||
:firstName => 'Тестовый',
|
:firstName => 'John',
|
||||||
:lastName => 'Клиент',
|
:lastName => 'Doe',
|
||||||
:phones => [{:number => '+79099099090'}],
|
:phones => [{:number => '+79099099090'}],
|
||||||
},
|
},
|
||||||
:delivery => {
|
:delivery => {
|
||||||
:code => 'courier',
|
:code => 'courier',
|
||||||
:cost => 500,
|
:cost => 500
|
||||||
:address => {:text => '344000, Ростов-на-Дону, пр. Буденовский, 13'}
|
|
||||||
},
|
},
|
||||||
:status => 'new',
|
:status => 'new',
|
||||||
:items => [
|
:items => [
|
||||||
{
|
{
|
||||||
:productName => 'Товар 1',
|
:productName => 'First',
|
||||||
:initialPrice => 500,
|
:initialPrice => 500,
|
||||||
:quantity => 2
|
:quantity => 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:productName => 'Товар 2',
|
:productName => 'Second',
|
||||||
:initialPrice => 1300,
|
:initialPrice => 1300,
|
||||||
:quantity => 1
|
:quantity => 1
|
||||||
}
|
}
|
||||||
@ -75,24 +74,23 @@ class Bootstrap
|
|||||||
:firstName => 'API',
|
:firstName => 'API',
|
||||||
:lastName => 'Test',
|
:lastName => 'Test',
|
||||||
:customer => {
|
:customer => {
|
||||||
:firstName => 'Тестовый',
|
:firstName => 'John',
|
||||||
:lastName => 'Клиент',
|
:lastName => 'Doe',
|
||||||
:phones => [{:number => '+79099099090'}],
|
:phones => [{:number => '+79099099090'}],
|
||||||
},
|
},
|
||||||
:delivery => {
|
:delivery => {
|
||||||
:code => 'courier',
|
:code => 'courier',
|
||||||
:cost => 500,
|
:cost => 500
|
||||||
:address => {:text => '344000, Ростов-на-Дону, пр. Буденовский, 13'}
|
|
||||||
},
|
},
|
||||||
:status => 'new',
|
:status => 'new',
|
||||||
:items => [
|
:items => [
|
||||||
{
|
{
|
||||||
:productName => 'Товар 1',
|
:productName => 'First',
|
||||||
:initialPrice => 500,
|
:initialPrice => 500,
|
||||||
:quantity => 2
|
:quantity => 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:productName => 'Товар 2',
|
:productName => 'Second',
|
||||||
:initialPrice => 1300,
|
:initialPrice => 1300,
|
||||||
:quantity => 1
|
:quantity => 1
|
||||||
}
|
}
|
||||||
@ -107,24 +105,23 @@ class Bootstrap
|
|||||||
:firstName => 'API2',
|
:firstName => 'API2',
|
||||||
:lastName => 'Test2',
|
:lastName => 'Test2',
|
||||||
:customer => {
|
:customer => {
|
||||||
:firstName => 'Тестовый2',
|
:firstName => 'Joe',
|
||||||
:lastName => 'Клиент2',
|
:lastName => 'Doe',
|
||||||
:phones => [{:number => '+79099099000'}],
|
:phones => [{:number => '+79099099000'}],
|
||||||
},
|
},
|
||||||
:delivery => {
|
:delivery => {
|
||||||
:code => 'ems',
|
:code => 'ems',
|
||||||
:cost => 500,
|
:cost => 500
|
||||||
:address => {:text => '344000, Ростов-на-Дону, пр. Буденовский, 15'}
|
|
||||||
},
|
},
|
||||||
:status => 'availability-confirmed',
|
:status => 'availability-confirmed',
|
||||||
:items => [
|
:items => [
|
||||||
{
|
{
|
||||||
:productName => 'Товар 3',
|
:productName => 'Third',
|
||||||
:initialPrice => 500,
|
:initialPrice => 500,
|
||||||
:quantity => 2
|
:quantity => 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:productName => 'Товар 4',
|
:productName => 'Extra',
|
||||||
:initialPrice => 1300,
|
:initialPrice => 1300,
|
||||||
:quantity => 1
|
:quantity => 1
|
||||||
}
|
}
|
||||||
@ -192,7 +189,7 @@ class Bootstrap
|
|||||||
},
|
},
|
||||||
sites_edit: {
|
sites_edit: {
|
||||||
name: 'Rake Shop',
|
name: 'Rake Shop',
|
||||||
url: 'http://yandex.ru',
|
url: 'http://example.org',
|
||||||
code: 'api-client-all',
|
code: 'api-client-all',
|
||||||
loadFromYml: false,
|
loadFromYml: false,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user