Class: Usps::Imis::Panel::Properties

Inherits:
Object
  • Object
show all
Defined in:
lib/usps/imis/panel/properties.rb

Overview

Constructor for the Properties field for Panel requests

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.buildObject

Build the data for a new Properties field



11
# File 'lib/usps/imis/panel/properties.rb', line 11

def self.build(&) = new.build(&)

Instance Method Details

#add(name, value) ⇒ Object

Add an individual property to the field



28
29
30
31
32
33
34
35
# File 'lib/usps/imis/panel/properties.rb', line 28

def add(name, value)
  @properties ||= []
  @properties << {
    '$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
    'Name' => name,
    'Value' => wrap(value)
  }
end

#build {|_self| ... } ⇒ Object

Build the data for the Properties field

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
19
20
21
22
23
24
# File 'lib/usps/imis/panel/properties.rb', line 15

def build
  yield(self)

  {
    'Properties' => {
      '$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts',
      '$values' => @properties
    }
  }
end