mirror of
https://github.com/retailcrm/api-client-ruby.git
synced 2024-11-22 13:06:06 +03:00
add all available methods
This commit is contained in:
parent
c358e13330
commit
a0ebbe5b38
150
lib/retailcrm.rb
150
lib/retailcrm.rb
@ -64,10 +64,12 @@ class Retailcrm
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# id (Integer)
|
# id (Integer)
|
||||||
# by (String)
|
# by (String)
|
||||||
def orders_get(id, by = 'externalId')
|
# site (String)
|
||||||
|
def orders_get(id, by = 'externalId', site = nil)
|
||||||
url = "#{@url}orders/#{id}"
|
url = "#{@url}orders/#{id}"
|
||||||
if by != 'externalId'
|
if by != 'externalId'
|
||||||
@params[:by] = by
|
@params[:by] = by
|
||||||
|
@params[:site] = site
|
||||||
end
|
end
|
||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
@ -82,9 +84,11 @@ class Retailcrm
|
|||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# order (Array)
|
# order (Array)
|
||||||
def orders_create(order)
|
# site (String)
|
||||||
|
def orders_create(order, site = nil)
|
||||||
url = "#{@url}orders/create"
|
url = "#{@url}orders/create"
|
||||||
@params[:order] = order.to_json
|
@params[:order] = order.to_json
|
||||||
|
@params[:site] = site
|
||||||
make_request(url, 'post')
|
make_request(url, 'post')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -98,10 +102,12 @@ class Retailcrm
|
|||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# order (Array)
|
# order (Array)
|
||||||
def orders_edit(order)
|
# site (String)
|
||||||
|
def orders_edit(order, site = nil)
|
||||||
id = order[:externalId]
|
id = order[:externalId]
|
||||||
url = "#{@url}orders/#{id}/edit"
|
url = "#{@url}orders/#{id}/edit"
|
||||||
@params[:order] = order.to_json
|
@params[:order] = order.to_json
|
||||||
|
@params[:site] = site
|
||||||
make_request(url, 'post')
|
make_request(url, 'post')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -115,9 +121,11 @@ class Retailcrm
|
|||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# orders (Array)
|
# orders (Array)
|
||||||
def orders_upload(orders)
|
# site (String)
|
||||||
|
def orders_upload(orders, site = nil)
|
||||||
url = "#{@url}orders/upload"
|
url = "#{@url}orders/upload"
|
||||||
@params[:orders] = orders.to_json
|
@params[:orders] = orders.to_json
|
||||||
|
@params[:site] = site
|
||||||
make_request(url, 'post')
|
make_request(url, 'post')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -212,8 +220,10 @@ class Retailcrm
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# id (Integer)
|
# id (Integer)
|
||||||
# by (String)
|
# by (String)
|
||||||
def customers_get(id, by = 'externalId')
|
# site (String)
|
||||||
|
def customers_get(id, by = 'externalId', site = nil)
|
||||||
url = "#{@url}customers/#{id}"
|
url = "#{@url}customers/#{id}"
|
||||||
|
@params[:site] = site
|
||||||
if by != 'externalId'
|
if by != 'externalId'
|
||||||
@params[:by] = by
|
@params[:by] = by
|
||||||
end
|
end
|
||||||
@ -230,9 +240,11 @@ class Retailcrm
|
|||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# customer (Array)
|
# customer (Array)
|
||||||
def customers_create(customer)
|
# site (String)
|
||||||
|
def customers_create(customer, site = nil)
|
||||||
url = "#{@url}customers/create"
|
url = "#{@url}customers/create"
|
||||||
@params[:customer] = customer.to_json
|
@params[:customer] = customer.to_json
|
||||||
|
@params[:site] = site
|
||||||
make_request(url, 'post')
|
make_request(url, 'post')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -246,10 +258,12 @@ class Retailcrm
|
|||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# customer (Array)
|
# customer (Array)
|
||||||
def customers_edit(customer)
|
# site (String)
|
||||||
|
def customers_edit(customer, site = nil)
|
||||||
id = customer[:externalId]
|
id = customer[:externalId]
|
||||||
url = "#{@url}customers/#{id}/edit"
|
url = "#{@url}customers/#{id}/edit"
|
||||||
@params[:customer] = customer.to_json
|
@params[:customer] = customer.to_json
|
||||||
|
@params[:site] = site
|
||||||
make_request(url, 'post')
|
make_request(url, 'post')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -263,9 +277,11 @@ class Retailcrm
|
|||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# customers (Array)
|
# customers (Array)
|
||||||
def customers_upload(customers)
|
# site (String)
|
||||||
|
def customers_upload(customers, site = nil)
|
||||||
url = "#{@url}customers/upload"
|
url = "#{@url}customers/upload"
|
||||||
@params[:customers] = customers.to_json
|
@params[:customers] = customers.to_json
|
||||||
|
@params[:site] = site
|
||||||
make_request(url, 'post')
|
make_request(url, 'post')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -305,6 +321,24 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Set purchace prices & stock balance
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# >> Retailcrm.store_inventories_upload({:offers => [{:externalId => 123, :stores => [{:code => 'store_1', :available => 15, :purchasePrice => 1000}]}]}, :site => 'main_site')
|
||||||
|
# => {...}
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# offers (Array)
|
||||||
|
# site (String)
|
||||||
|
def store_inventories_upload(offers = [], site = nil)
|
||||||
|
url = "#{@url}store/inventories/upload"
|
||||||
|
@params[:offers] = offers
|
||||||
|
@params[:site] = site
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get delivery services
|
# === Get delivery services
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -314,6 +348,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit delivery service
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def delivery_services_edit(delivery_service)
|
||||||
|
code = delivery_service[:code]
|
||||||
|
url = "#{@url}reference/delivery-services/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
# Get delivery types
|
# Get delivery types
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
#
|
#
|
||||||
@ -322,6 +366,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit delivery type
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def delivery_types_edit(delivery_type)
|
||||||
|
code = delivery_type[:code]
|
||||||
|
url = "#{@url}reference/delivery-types/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get order methods
|
# === Get order methods
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -331,6 +385,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit order method
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def order_methods_edit(order_method)
|
||||||
|
code = order_method[:code]
|
||||||
|
url = "#{@url}reference/order-methods/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get order types
|
# === Get order types
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -340,6 +404,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit order type
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def order_types_edit(order_type)
|
||||||
|
code = order_type[:code]
|
||||||
|
url = "#{@url}reference/order-types/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
# Get payment statuses
|
# Get payment statuses
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
#
|
#
|
||||||
@ -348,6 +422,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit payment status
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def payment_statuses_edit(payment_status)
|
||||||
|
code = payment_status[:code]
|
||||||
|
url = "#{@url}reference/payment-statuses/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get payment types
|
# === Get payment types
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -357,6 +441,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit payment type
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def payment_types_edit(payment_type)
|
||||||
|
code = payment_type[:code]
|
||||||
|
url = "#{@url}reference/payment-type/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get product statuses
|
# === Get product statuses
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -366,6 +460,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit product status
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def product_statuses_edit(product_status)
|
||||||
|
code = product_status[:code]
|
||||||
|
url = "#{@url}reference/product-statuses/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
# Get sites list
|
# Get sites list
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
#
|
#
|
||||||
@ -374,6 +478,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit site
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def sites_edit(site)
|
||||||
|
code = site[:code]
|
||||||
|
url = "#{@url}reference/sites/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get status groups
|
# === Get status groups
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -391,6 +505,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit status
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def statuses_edit(status)
|
||||||
|
code = status[:code]
|
||||||
|
url = "#{@url}reference/statuses/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Get stores
|
# === Get stores
|
||||||
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
@ -400,6 +524,16 @@ class Retailcrm
|
|||||||
make_request(url)
|
make_request(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# === Edit store
|
||||||
|
# http://www.retailcrm.ru/docs/Разработчики/СправочникМетодовAPIV3
|
||||||
|
#
|
||||||
|
def stores_edit(store)
|
||||||
|
code = store[:code]
|
||||||
|
url = "#{@url}reference/stores/#{code}/edit"
|
||||||
|
make_request(url, 'post')
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# === Statistic update
|
# === Statistic update
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'retailcrm'
|
s.name = 'retailcrm'
|
||||||
s.version = '1.0.2'
|
s.version = '1.1.0'
|
||||||
s.date = '2015-04-14'
|
s.date = '2015-04-15'
|
||||||
s.summary = 'RetailCRM Rest API client'
|
s.summary = 'RetailCRM Rest API client'
|
||||||
s.description = 'Library for interact with RetailCRM API'
|
s.description = 'Library for interact with RetailCRM API'
|
||||||
s.authors = ['Alex Lushpai']
|
s.authors = ['Alex Lushpai']
|
||||||
|
Loading…
Reference in New Issue
Block a user