Class: Vng::Route
Overview
Provides methods to interact with Vonigo ZIP routes.
Constant Summary collapse
- PATH =
'/api/v1/resources/Routes/'
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type_id ⇒ Object
readonly
Returns the value of attribute type_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, type_id:) ⇒ Route
constructor
A new instance of Route.
Constructor Details
#initialize(id:, name:, type_id:) ⇒ Route
Returns a new instance of Route.
10 11 12 13 14 |
# File 'lib/vng/route.rb', line 10 def initialize(id:, name:, type_id:) @id = id @name = name @type_id = type_id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vng/route.rb', line 8 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/vng/route.rb', line 8 def name @name end |
#type_id ⇒ Object (readonly)
Returns the value of attribute type_id.
8 9 10 |
# File 'lib/vng/route.rb', line 8 def type_id @type_id end |
Class Method Details
.all ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vng/route.rb', line 16 def self.all data = request path: PATH data.fetch('Routes', []).filter_map do |body| next unless active?(body) id = body['routeID'] name = body['routeName'] type_id = body['routeTypeID'] new id: id, name: name, type_id: type_id end end |