Class: Inttegro::Resources::Prices
- Inherits:
-
Object
- Object
- Inttegro::Resources::Prices
- Defined in:
- lib/inttegro/resources/prices.rb
Overview
Client for catalog prices and their lifecycle.
Access this resource through Client#prices.
Instance Method Summary collapse
-
#activate(price_id:) ⇒ Inttegro::Price::CatalogPrice
Reactivate an inactive price.
-
#archive(price_id:) ⇒ Inttegro::Price::CatalogPrice
Archive a price and mark it inactive.
-
#create(payload) ⇒ Inttegro::Price::CatalogPrice
Create a catalog price.
-
#deactivate(price_id:) ⇒ Inttegro::Price::CatalogPrice
Deactivate a price for new active catalog flows.
-
#initialize(http) ⇒ Prices
constructor
A new instance of Prices.
-
#lookup(price_id:) ⇒ Inttegro::Price::CatalogPrice
Retrieve one catalog price.
-
#page(payload = {}) ⇒ Inttegro::Price::Page
Retrieve a page of catalog prices.
-
#update(payload) ⇒ Inttegro::Price::CatalogPrice
Update mutable price metadata.
Constructor Details
#initialize(http) ⇒ Prices
Returns a new instance of Prices.
11 12 13 |
# File 'lib/inttegro/resources/prices.rb', line 11 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#activate(price_id:) ⇒ Inttegro::Price::CatalogPrice
Reactivate an inactive price.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/inttegro/resources/prices.rb', line 75 def activate(price_id:) T.cast( @http.post_union_resource( "/prices/activate", [Inttegro::Price::Fixed, Inttegro::Customer::SelectedCatalogPrice], :price, { price_id: price_id } ), Inttegro::Price::CatalogPrice ) end |
#archive(price_id:) ⇒ Inttegro::Price::CatalogPrice
Archive a price and mark it inactive.
107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/inttegro/resources/prices.rb', line 107 def archive(price_id:) T.cast( @http.post_union_resource( "/prices/archive", [Inttegro::Price::Fixed, Inttegro::Customer::SelectedCatalogPrice], :price, { price_id: price_id } ), Inttegro::Price::CatalogPrice ) end |
#create(payload) ⇒ Inttegro::Price::CatalogPrice
Create a catalog price.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/inttegro/resources/prices.rb', line 19 def create(payload) T.cast( @http.post_union_resource( "/prices/create", [Inttegro::Price::Fixed, Inttegro::Customer::SelectedCatalogPrice], :price, payload ), Inttegro::Price::CatalogPrice ) end |
#deactivate(price_id:) ⇒ Inttegro::Price::CatalogPrice
Deactivate a price for new active catalog flows.
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/inttegro/resources/prices.rb', line 91 def deactivate(price_id:) T.cast( @http.post_union_resource( "/prices/deactivate", [Inttegro::Price::Fixed, Inttegro::Customer::SelectedCatalogPrice], :price, { price_id: price_id } ), Inttegro::Price::CatalogPrice ) end |
#lookup(price_id:) ⇒ Inttegro::Price::CatalogPrice
Retrieve one catalog price.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/inttegro/resources/prices.rb', line 35 def lookup(price_id:) T.cast( @http.post_union_resource( "/prices/lookup", [Inttegro::Price::Fixed, Inttegro::Customer::SelectedCatalogPrice], :price, { price_id: price_id } ), Inttegro::Price::CatalogPrice ) end |
#page(payload = {}) ⇒ Inttegro::Price::Page
Retrieve a page of catalog prices.
51 52 53 |
# File 'lib/inttegro/resources/prices.rb', line 51 def page(payload = {}) @http.post_resource("/prices/page", Inttegro::Price::Page, :page, payload || {}) end |
#update(payload) ⇒ Inttegro::Price::CatalogPrice
Update mutable price metadata.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inttegro/resources/prices.rb', line 59 def update(payload) T.cast( @http.post_union_resource( "/prices/update", [Inttegro::Price::Fixed, Inttegro::Customer::SelectedCatalogPrice], :price, payload ), Inttegro::Price::CatalogPrice ) end |