milkfarm-onix 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/onix.rb +1 -1
- data/lib/onix/price.rb +1 -1
- data/lib/onix/sl_product.rb +13 -0
- metadata +3 -3
data/lib/onix.rb
CHANGED
data/lib/onix/price.rb
CHANGED
@@ -7,7 +7,7 @@ module ONIX
|
|
7
7
|
xml_name "Price"
|
8
8
|
|
9
9
|
xml_accessor :price_type_code, :from => "PriceTypeCode", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
|
10
|
-
xml_accessor :price_type_qualifier, :from => "
|
10
|
+
xml_accessor :price_type_qualifier, :from => "PriceQualifier", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
|
11
11
|
xml_accessor :price_type_description, :from => "PriceTypeDescription"
|
12
12
|
xml_accessor :price_per, :from => "PricePer", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
|
13
13
|
xml_accessor :minimum_order_qty, :from => "MinimumOrderQuantity", :as => Fixnum
|
data/lib/onix/sl_product.rb
CHANGED
@@ -52,6 +52,19 @@ module ONIX
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def add_price(amount, *args)
|
56
|
+
options = args.extract_options!.symbolize_keys
|
57
|
+
# restrict keys to setter methods of format "text="
|
58
|
+
keys = ONIX::Price.instance_methods.delete_if{|x| ! /\w+=$/.match(x)}.map{|x| x.gsub(/=$/, '').to_sym}
|
59
|
+
options.assert_valid_keys(keys)
|
60
|
+
options.reverse_merge!(:price_type_code => 1)
|
61
|
+
price = ONIX::Price.new
|
62
|
+
price.price_amount = amount
|
63
|
+
options.each { |k, v| price.send("#{k}=", v) }
|
64
|
+
supply = find_or_create_supply_detail
|
65
|
+
supply.prices << price
|
66
|
+
end
|
67
|
+
|
55
68
|
# retrieve an array of all languages
|
56
69
|
def languages
|
57
70
|
product.languages.collect { |language| language.language_code}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milkfarm-onix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 6
|
10
|
+
version: 0.8.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Healy
|