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
22
23
24
25
26
27
|
# File 'lib/sell_object/buscape.rb', line 22
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
20
|
# 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?
store_name = store_name.gsub(/ +/, '_')
result = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
xml. timestamp
xml.send(store_name) {
xml.produtos do
xml << elements
end
}
end
result.to_xml
end
|
Instance Method Details
#to_buscape(store_name = nil) ⇒ Object
Instance methods added on inclusion
40
41
42
|
# File 'lib/sell_object/buscape.rb', line 40
def to_buscape(store_name = nil)
self.class.to_buscape [self], store_name
end
|