Module: SellObject::Buscape
- Defined in:
- lib/sell_object/buscape.rb,
lib/sell_object/buscape/formatter_proxy.rb
Defined Under Namespace
Modules: ClassMethods
Classes: FormatterProxy
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
3
4
5
|
# File 'lib/sell_object/buscape.rb', line 3
def self.included(base)
base.extend ClassMethods
end
|
.timestamp ⇒ Object
21
22
23
24
25
26
|
# File 'lib/sell_object/buscape.rb', line 21
def self.timestamp
now = Time.now
zone_diff = now.strftime("%z").to_i / 100
time = now.strftime "%Y-%m-%dT%H:%M:%SGMT#{'+' if zone_diff >= 0}#{zone_diff}"
"Generated at #{time}"
end
|
.wrap_xml(elements, store_name = nil) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/sell_object/buscape.rb', line 7
def self.wrap_xml(elements, store_name = nil)
store_name ||= SellObject::Config.store_name
raise ArgumentError, 'No store name found (nil). You have to either pass it as an argument or set it up in SellObject::Config' if store_name.nil?
%Q{
<?xml version="1.0" encoding="UTF-8" ?>
<!-- #{timestamp} -->
<#{store_name}>
<produtos>
#{elements}
</produtos>
</#{store_name}>
}
end
|
Instance Method Details
#to_buscape(store_name = nil) ⇒ Object
Instance methods added on inclusion
39
40
41
|
# File 'lib/sell_object/buscape.rb', line 39
def to_buscape(store_name = nil)
self.class.to_buscape [self], store_name
end
|