Class: OffTheGridTrucks::Event
- Inherits:
-
Object
- Object
- OffTheGridTrucks::Event
- Defined in:
- lib/off_the_grid_trucks/event.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#assigned_vendors ⇒ Object
readonly
Returns the value of attribute assigned_vendors.
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_featured ⇒ Object
readonly
Returns the value of attribute is_featured.
-
#location_id ⇒ Object
readonly
Returns the value of attribute location_id.
-
#location_name ⇒ Object
readonly
Returns the value of attribute location_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number_of_assigned_vendors ⇒ Object
readonly
Returns the value of attribute number_of_assigned_vendors.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(args) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/off_the_grid_trucks/event.rb', line 9 def initialize(args) @id = args.fetch('id') {} @name = args.fetch('name') {} @start_time = args.fetch('startTime') {} @end_time = args.fetch('endTime') {} @location_id = args.fetch('locationId') {} @location_name = args.fetch('locationName') {} @assigned_vendors = args.fetch('assignedVendors') {} @number_of_assigned_vendors = args.fetch('numberOfAssignedVendors') {} @is_featured = args.fetch('isFeatured') {} end |
Instance Attribute Details
#assigned_vendors ⇒ Object (readonly)
Returns the value of attribute assigned_vendors.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def assigned_vendors @assigned_vendors end |
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def end_time @end_time end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def id @id end |
#is_featured ⇒ Object (readonly)
Returns the value of attribute is_featured.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def is_featured @is_featured end |
#location_id ⇒ Object (readonly)
Returns the value of attribute location_id.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def location_id @location_id end |
#location_name ⇒ Object (readonly)
Returns the value of attribute location_name.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def location_name @location_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def name @name end |
#number_of_assigned_vendors ⇒ Object (readonly)
Returns the value of attribute number_of_assigned_vendors.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def number_of_assigned_vendors @number_of_assigned_vendors end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
6 7 8 |
# File 'lib/off_the_grid_trucks/event.rb', line 6 def start_time @start_time end |
Class Method Details
.all(from_date: 0, to_date: Time.now) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/off_the_grid_trucks/event.rb', line 22 def all(from_date: 0, to_date: Time.now) query = { dateFrom: date_to_seconds(from_date), dateTo: date_to_seconds(to_date) } Request.get( resource: 'events', query: query )['events'].map { |event| new(event) } end |