Class: Vng::PriceList
Overview
Provides methods to interact with Vonigo price lists.
Constant Summary collapse
- PATH =
'/api/v1/resources/priceLists/'
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:) ⇒ PriceList
constructor
A new instance of PriceList.
Constructor Details
#initialize(id:, name:) ⇒ PriceList
Returns a new instance of PriceList.
10 11 12 13 |
# File 'lib/vng/price_list.rb', line 10 def initialize(id:, name:) @id = id @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vng/price_list.rb', line 8 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/vng/price_list.rb', line 8 def name @name end |
Class Method Details
.all ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vng/price_list.rb', line 15 def self.all data = request path: PATH data.fetch('PriceLists', []).filter_map do |price_list| next unless price_list['isActive'] next unless price_list['serviceTypeID'].eql?(14) id = price_list['priceListID'] name = price_list['priceList'] new id: id, name: name end end |