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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:) ⇒ Route
constructor
A new instance of Route.
Constructor Details
#initialize(id:, name:) ⇒ Route
Returns a new instance of Route.
10 11 12 13 |
# File 'lib/vng/route.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/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 |
Class Method Details
.all ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vng/route.rb', line 15 def self.all data = request path: PATH data['Routes'].filter do |route| route['isActive'] end.map do |body| id = body['routeID'] name = body['routeName'] new id: id, name: name end end |