api-client-ruby/test/bootstrap.rb.dist

134 lines
3.7 KiB
Plaintext
Raw Normal View History

2015-04-13 03:14:25 +03:00
# encoding: utf-8
class Bootstrap
attr_reader :api_key, :api_url, :order, :order_edit, :orders, :customer
2015-04-13 03:14:25 +03:00
def initialize
2015-04-13 03:14:25 +03:00
@api_url = 'https://demo.retailcrm.ru'
@api_key = ''
id = Time.now.to_i
time = Time.now.strftime('%F %T')
2015-04-13 03:14:25 +03:00
@customer = {
:externalId => id,
:createdAt => time,
:firstName => 'API',
:lastName => 'Test',
:email => 'pupkin@example.org',
:phones => [{:number => '+79099099090'}]
}
@order = {
:externalId => id,
:number => "#{id}",
:orderType => 'eshop-individual',
:orderMethod => 'phone',
:createdAt => time,
:discountPercent => 10,
:firstName => 'API',
:lastName => 'Test',
:customer => {
:firstName => 'Тестовый',
:lastName => 'Клиент',
:phones => [{:number => '+79099099090'}],
},
:delivery => {
:code => 'courier',
:cost => 500,
:address => {:text => '344000, Ростов-на-Дону, пр. Буденовский, 13'}
},
:status => 'new',
:items => [
{
:productName => 'Товар 1',
:initialPrice => 500,
:quantity => 2
},
{
:productName => 'Товар 2',
:initialPrice => 1300,
:quantity => 1
}
]
}
@order_edit = {
:externalId => 1428877985,
:email => 'test@example.org',
:phone => '+79999999999',
:status => 'cancel-other',
}
@orders = [
{
:externalId => id,
:number => "#{id}",
:orderType => 'eshop-individual',
:orderMethod => 'phone',
:createdAt => time,
:discountPercent => 10,
:firstName => 'API',
:lastName => 'Test',
:customer => {
:firstName => 'Тестовый',
:lastName => 'Клиент',
:phones => [{:number => '+79099099090'}],
},
:delivery => {
:code => 'courier',
:cost => 500,
:address => {:text => '344000, Ростов-на-Дону, пр. Буденовский, 13'}
},
:status => 'new',
:items => [
{
:productName => 'Товар 1',
:initialPrice => 500,
:quantity => 2
},
{
:productName => 'Товар 2',
:initialPrice => 1300,
:quantity => 1
}
]
},
{
:externalId => id+1,
:number => "#{id+1}",
:orderType => 'eshop-individual',
:createdAt => time,
:discount => 200,
:firstName => 'API2',
:lastName => 'Test2',
:customer => {
:firstName => 'Тестовый2',
:lastName => 'Клиент2',
:phones => [{:number => '+79099099000'}],
},
:delivery => {
:code => 'ems',
:cost => 500,
:address => {:text => '344000, Ростов-на-Дону, пр. Буденовский, 15'}
},
:status => 'availability-confirmed',
:items => [
{
:productName => 'Товар 3',
:initialPrice => 500,
:quantity => 2
},
{
:productName => 'Товар 4',
:initialPrice => 1300,
:quantity => 1
}
]
}
]
2015-04-13 03:14:25 +03:00
end
end