Class: Inttegro::Resources::Prices

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(http) ⇒ Prices

Returns a new instance of Prices.

Parameters:



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.

Parameters:

  • price_id (String) —

    unique price identifier

Returns:



51
52
53
# File 'lib/inttegro/resources/prices.rb', line 51

def activate(price_id:)
  @http.post_resource("/prices/activate", Inttegro::Price::CatalogPrice, :price, { price_id: price_id })
end

#archive(price_id:) ⇒ Inttegro::Price::CatalogPrice

Archive a price and mark it inactive.

Parameters:

  • price_id (String) —

    unique price identifier

Returns:



67
68
69
# File 'lib/inttegro/resources/prices.rb', line 67

def archive(price_id:)
  @http.post_resource("/prices/archive", Inttegro::Price::CatalogPrice, :price, { price_id: price_id })
end

#create(payload) ⇒ Inttegro::Price::CatalogPrice

Create a catalog price.

Parameters:

Returns:



19
20
21
# File 'lib/inttegro/resources/prices.rb', line 19

def create(payload)
  @http.post_resource("/prices/create", Inttegro::Price::CatalogPrice, :price, payload)
end

#deactivate(price_id:) ⇒ Inttegro::Price::CatalogPrice

Deactivate a price for new active catalog flows.

Parameters:

  • price_id (String) —

    unique price identifier

Returns:



59
60
61
# File 'lib/inttegro/resources/prices.rb', line 59

def deactivate(price_id:)
  @http.post_resource("/prices/deactivate", Inttegro::Price::CatalogPrice, :price, { price_id: price_id })
end

#lookup(price_id:) ⇒ Inttegro::Price::CatalogPrice

Retrieve one catalog price.

Parameters:

  • price_id (String) —

    unique price identifier

Returns:



27
28
29
# File 'lib/inttegro/resources/prices.rb', line 27

def lookup(price_id:)
  @http.post_resource("/prices/lookup", Inttegro::Price::CatalogPrice, :price, { price_id: price_id })
end

#page(payload = {}) ⇒ Inttegro::Price::Page

Retrieve a page of catalog prices.

Parameters:

Returns:



35
36
37
# File 'lib/inttegro/resources/prices.rb', line 35

def page(payload = {})
  @http.post_resource("/prices/page", Inttegro::Price::Page, :page, payload || {})
end

#update(payload) ⇒ Inttegro::Price::CatalogPrice

Update mutable price metadata.

Parameters:

Returns:



43
44
45
# File 'lib/inttegro/resources/prices.rb', line 43

def update(payload)
  @http.post_resource("/prices/update", Inttegro::Price::CatalogPrice, :price, payload)
end