Class: MoySklad::Client::Base
Direct Known Subclasses
Model::CashIn, Model::Company, Model::Country, Model::Currency, Model::CustomEntity, Model::CustomerOrder, Model::Demand, Model::Good, Model::GoodFolder, Model::InvoiceOut, Model::PaymentIn, Model::StockTo, Model::Supply, Model::Warehouse
Constant Summary
collapse
- @@template_path =
File.join(File.dirname(__FILE__), '..', 'model', 'templates')
Class Method Summary
collapse
Instance Method Summary
collapse
#find_object
Class Method Details
.collection_name ⇒ Object
37
38
39
|
# File 'lib/moy_sklad/client/base.rb', line 37
def collection_name
@collection_name ||= "#{element_name.classify}/list"
end
|
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/moy_sklad/client/base.rb', line 25
def element_path(id, prefix_options = {}, query_options = nil)
check_prefix_options(prefix_options)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{element_name.classify}/" \
"#{URI.parser.escape id.to_s}#{query_string(query_options)}"
end
|
.find(*args) ⇒ Object
18
19
20
21
22
|
# File 'lib/moy_sklad/client/base.rb', line 18
def find(*args)
self.format.element_name = element_name.classify
super(*args)
end
|
.new_element_path(prefix_options = {}) ⇒ Object
33
34
35
|
# File 'lib/moy_sklad/client/base.rb', line 33
def new_element_path(prefix_options = {})
"#{prefix(prefix_options)}#{element_name.classify}"
end
|
Instance Method Details
#applicable? ⇒ Boolean
56
57
58
|
# File 'lib/moy_sklad/client/base.rb', line 56
def applicable?
applicable.to_s == 'true'
end
|
#create ⇒ Object
Override create method, this required because moysklad uses PUT instead of POST
43
44
45
|
# File 'lib/moy_sklad/client/base.rb', line 43
def create
run_callbacks :create do _create end
end
|
#destroy ⇒ Object
47
48
49
|
# File 'lib/moy_sklad/client/base.rb', line 47
def destroy
run_callbacks :destroy do _destroy end
end
|