Class: Vng::PriceBlock
Overview
Provides methods to interact with Vonigo price blocks.
Constant Summary collapse
- PATH =
'/api/v1/resources/priceBlocks/'
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, index:) ⇒ PriceBlock
constructor
A new instance of PriceBlock.
Constructor Details
#initialize(id:, name:, index:) ⇒ PriceBlock
Returns a new instance of PriceBlock.
11 12 13 14 15 |
# File 'lib/vng/price_block.rb', line 11 def initialize(id:, name:, index:) @id = id @name = name @index = index end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/vng/price_block.rb', line 9 def id @id end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
9 10 11 |
# File 'lib/vng/price_block.rb', line 9 def index @index end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/vng/price_block.rb', line 9 def name @name end |
Class Method Details
.for_price_list_id(price_list_id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vng/price_block.rb', line 17 def self.for_price_list_id(price_list_id) body = { priceListID: price_list_id } data = request path: PATH, body: body, returning: 'PriceBlocks' data.filter_map do |body| next unless body['isActive'] id = body['priceBlockID'] name = body['priceBlock'] index = body['sequence'] new id: id, name: name, index: index end end |