Class: Shipvine::ItemGroup
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(attributes) ⇒ ItemGroup
constructor
A new instance of ItemGroup.
Methods inherited from Base
Constructor Details
#initialize(attributes) ⇒ ItemGroup
Returns a new instance of ItemGroup.
22 23 24 |
# File 'lib/shipvine/item_group.rb', line 22 def initialize(attributes) @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
20 21 22 |
# File 'lib/shipvine/item_group.rb', line 20 def attributes @attributes end |
Class Method Details
.get(item_merchant_identifier) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/shipvine/item_group.rb', line 4 def self.get(item_merchant_identifier) request = self.client.request( :get, # TODO escape SKU? '/item-groups/' + Shipvine.merchant_code + '/' + item_merchant_identifier ) self.new(self.xml_to_hash(request.body)) rescue Shipvine::Error => e nil end |
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/shipvine/item_group.rb', line 26 def create translated_payload = @attributes.deep_dup merchant_identifier = translated_payload.delete(:merchant_identifier) client.request( :put, '/item-groups/' + Shipvine.merchant_code + '/' + merchant_identifier, request_body('ItemGroup', translated_payload) ) end |