Class: Usps::Imis::Panels::BasePanel
- Inherits:
-
Object
- Object
- Usps::Imis::Panels::BasePanel
- Defined in:
- lib/usps/imis/panels/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, *fields) ⇒ Hash+
(also: #read)
Get a specific object from the Panel.
-
#get_field(ordinal, field) ⇒ Hash
(also: #fetch)
Get a single named field from a Panel for the current member.
-
#get_fields(ordinal, *fields) ⇒ Hash
(also: #fetch_all)
Get named fields 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/panels/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
80 |
# File 'lib/usps/imis/panels/base_panel.rb', line 80 def delete(ordinal) = api.on(business_object, ordinal:).delete |
#get(ordinal, *fields) ⇒ Hash+ Also known as: read
Get a specific object from the Panel
If fields is provided, will return only those field values
28 |
# File 'lib/usps/imis/panels/base_panel.rb', line 28 def get(ordinal, *fields) = api.on(business_object, ordinal:).get(*fields) |
#get_field(ordinal, field) ⇒ Hash Also known as: fetch
Get a single named field from a Panel for the current member
38 |
# File 'lib/usps/imis/panels/base_panel.rb', line 38 def get_field(ordinal, field) = api.on(business_object, ordinal:).get_field(field) |
#get_fields(ordinal, *fields) ⇒ Hash Also known as: fetch_all
Get named fields from a Panel for the current member
48 |
# File 'lib/usps/imis/panels/base_panel.rb', line 48 def get_fields(ordinal, *fields) = api.on(business_object, ordinal:).get_fields(*fields) |
#post(data) ⇒ Object Also known as: create
Create a new object in the Panel
73 |
# File 'lib/usps/imis/panels/base_panel.rb', line 73 def post(data) = api.on(business_object).post(payload(data)) |
#put(data) ⇒ Object Also known as: update
Update an existing object in the Panel
66 |
# File 'lib/usps/imis/panels/base_panel.rb', line 66 def put(data) = api.on(business_object, ordinal: data[:ordinal]).put(payload(data)) |
#put_fields(ordinal, fields) ⇒ Hash Also known as: patch
Update only specific fields on a Panel for the current member
58 |
# File 'lib/usps/imis/panels/base_panel.rb', line 58 def put_fields(ordinal, fields) = api.on(business_object, ordinal:).put_fields(fields) |