class Ingenico::Connect::SDK::Domain::Metadata::ShoppingCartExtension
Represents metadata part of shopping carts.
Attributes
creator[R]
extension_id[R]
name[R]
version[R]
Public Class Methods
new(creator, name, version, extension_id=nil)
click to toggle source
# File lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb, line 7 def initialize(creator, name, version, extension_id=nil) raise ArgumentError.new if creator.nil? or creator.strip.empty? raise ArgumentError.new if name.nil? or name.strip.empty? raise ArgumentError.new if version.nil? or version.to_s.strip.empty? @creator = creator @name = name @version = version.to_s @extension_id = extension_id end
new_from_hash(hash)
click to toggle source
Constructs a new ShoppingCartExtension
from parameter hash the hash should contain a creator, name, version and extensionId
# File lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb, line 23 def self.new_from_hash(hash) creator = hash['creator'] if hash.has_key?('creator') name = hash['name'] if hash.has_key?('name') version = hash['version'] if hash.has_key?('version') extension_id = hash['extensionId'] if hash.has_key?('extensionId') self.new(creator, name, version, extension_id) end
Public Instance Methods
from_hash(hash)
click to toggle source
loads shopping cart metadata from a parameter hash
Calls superclass method
Ingenico::Connect::SDK::DataObject#from_hash
# File lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb, line 42 def from_hash(hash) super @creator = hash['creator'] if hash.has_key? 'creator' @name = hash['name'] if hash.has_key? 'name' @version = hash['version'] if hash.has_key? 'version' @extension_id = hash['extensionId'] if hash.has_key? 'extensionId' end
to_h()
click to toggle source
Converts the shopping cart metadata to a hash
Calls superclass method
Ingenico::Connect::SDK::DataObject#to_h
# File lib/ingenico/connect/sdk/domain/metadata/shopping_cart_extension.rb, line 32 def to_h hash = super hash['creator'] = @creator unless @creator.nil? hash['name'] = @name unless @name.nil? hash['version'] = @version unless @version.nil? hash['extensionId'] = @extension_id unless @extension_id.nil? hash end