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
-
#delete(ordinal) ⇒ Object
(also: #destroy)
Remove a specific object from the Panel.
-
#get(ordinal) ⇒ Object
(also: #read)
Get a specific object from the Panel.
-
#get_field(ordinal, name) ⇒ Hash
(also: #fetch)
Get a single named field from a Panel for the current member.
-
#initialize(api = nil, imis_id: nil) ⇒ BasePanel
constructor
A new instance of BasePanel.
-
#post(data) ⇒ Object
(also: #create)
Create a new object in the Panel.
-
#put(data) ⇒ Object
(also: #update)
Update an existing object in the Panel.
-
#put_fields(ordinal, fields) ⇒ Hash
(also: #patch)
Update only specific fields on a Panel for the current member.
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
#delete(ordinal) ⇒ Object Also known as: destroy
Remove a specific object from the Panel
74 75 76 |
# File 'lib/usps/imis/panel/base_panel.rb', line 74 def delete(ordinal) api.on(business_object, ordinal:).delete end |
#get(ordinal) ⇒ Object Also known as: read
Get a specific object from the Panel
22 23 24 |
# File 'lib/usps/imis/panel/base_panel.rb', line 22 def get(ordinal) api.on(business_object, ordinal:).get end |
#get_field(ordinal, name) ⇒ Hash Also known as: fetch
Get a single named field from a Panel for the current member
34 35 36 |
# File 'lib/usps/imis/panel/base_panel.rb', line 34 def get_field(ordinal, name) api.on(business_object, ordinal:).get_field(name) end |
#post(data) ⇒ Object Also known as: create
Create a new object in the Panel
65 66 67 |
# File 'lib/usps/imis/panel/base_panel.rb', line 65 def post(data) api.on(business_object).post(payload(data)) end |
#put(data) ⇒ Object Also known as: update
Update an existing object in the Panel
56 57 58 |
# File 'lib/usps/imis/panel/base_panel.rb', line 56 def put(data) api.on(business_object, ordinal: data[:ordinal]).put(payload(data)) end |
#put_fields(ordinal, fields) ⇒ Hash Also known as: patch
Update only specific fields on a Panel for the current member
46 47 48 |
# File 'lib/usps/imis/panel/base_panel.rb', line 46 def put_fields(ordinal, fields) api.on(business_object, ordinal:).put_fields(fields) end |