Class: Usps::Imis::Panel::BasePanel
- Inherits:
-
Object
- Object
- Usps::Imis::Panel::BasePanel
- Defined in:
- lib/usps/imis/panel/base_panel.rb
Overview
Base class for configuring Panels
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
The parent
Apiobject.
Instance Method Summary collapse
-
#create(data) ⇒ Object
Create a new object in the Panel.
-
#destroy(ordinal) ⇒ Object
Remove a specific object from the Panel.
-
#get(ordinal) ⇒ Object
Get a specific object from the Panel.
-
#initialize(api = nil, imis_id: nil) ⇒ BasePanel
constructor
A new instance of BasePanel.
-
#update(data) ⇒ Object
Update an existing object in the Panel.
Constructor Details
Instance Attribute Details
#api ⇒ Object (readonly)
The parent Api object
11 12 13 |
# File 'lib/usps/imis/panel/base_panel.rb', line 11 def api @api end |
Instance Method Details
#create(data) ⇒ Object
Create a new object in the Panel
30 31 32 |
# File 'lib/usps/imis/panel/base_panel.rb', line 30 def create(data) api.business_object(business_object, url_id: '').post(payload(data)) end |
#destroy(ordinal) ⇒ Object
Remove a specific object from the Panel
49 50 51 |
# File 'lib/usps/imis/panel/base_panel.rb', line 49 def destroy(ordinal) api.business_object(business_object, url_id: "~#{api.imis_id}|#{ordinal}").delete end |
#get(ordinal) ⇒ Object
Get a specific object from the Panel
22 23 24 |
# File 'lib/usps/imis/panel/base_panel.rb', line 22 def get(ordinal) api.business_object(business_object, url_id: "~#{api.imis_id}|#{ordinal}").get end |
#update(data) ⇒ Object
Update an existing object in the Panel
39 40 41 42 43 |
# File 'lib/usps/imis/panel/base_panel.rb', line 39 def update(data) api .business_object(business_object, url_id: "~#{api.imis_id}|#{data[:ordinal]}") .put(payload(data)) end |