Class: GeoCerts::Event
Overview
GeoCerts tracks events which occur that are related to your Order(s). This class interfaces with those events to provide collections of all of your events or events against a particular GeoCerts::Order.
Instance Attribute Summary (collapse)
-
- (Object) created_at
Returns the value of attribute created_at.
-
- (Object) id
Returns the value of attribute id.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) order_id
Returns the value of attribute order_id.
Attributes inherited from ApiObject
Class Method Summary (collapse)
-
+ (Object) all(options = {})
Returns all events which occurred within the requested time window.
-
+ (Object) find(order_id, options = {})
Returns all events which occurred within the requested time window for the requested GeoCerts::Order.
-
+ (Object) find_by_order_id(order_id, options = {})
This method will not raise an exception for a missing order_id in the GeoCerts system.
Methods inherited from ApiObject
#errors, #errors=, #initialize, #warnings, #warnings=
Constructor Details
This class inherits a constructor from GeoCerts::ApiObject
Instance Attribute Details
- (Object) created_at
Returns the value of attribute created_at
10 11 12 |
# File 'lib/geo_certs/event.rb', line 10 def created_at @created_at end |
- (Object) id
Returns the value of attribute id
10 11 12 |
# File 'lib/geo_certs/event.rb', line 10 def id @id end |
- (Object) name
Returns the value of attribute name
10 11 12 |
# File 'lib/geo_certs/event.rb', line 10 def name @name end |
- (Object) order_id
Returns the value of attribute order_id
10 11 12 |
# File 'lib/geo_certs/event.rb', line 10 def order_id @order_id end |
Class Method Details
+ (Object) all(options = {})
Returns all events which occurred within the requested time window. The server defaults to a 15 minute window.
Options
:start_at |
The starting DateTime for the date range |
:end_at |
The ending DateTime for the date range |
25 26 27 28 29 |
# File 'lib/geo_certs/event.rb', line 25 def self.all( = {}) prep_date_ranges!() response = call_api { GeoCerts.api.events() } build_collection(response) { |response| response[:events][:event] } end |
+ (Object) find(order_id, options = {})
Returns all events which occurred within the requested time window for the requested GeoCerts::Order. The server defaults to a 15 minute window.
Options
:start_at |
The starting DateTime for the date range |
:end_at |
The ending DateTime for the date range |
Exceptions
This method will raise GeoCerts exceptions if the requested order_id cannot be found.
44 45 46 47 48 49 50 51 |
# File 'lib/geo_certs/event.rb', line 44 def self.find(order_id, = {}) prep_date_ranges!() order_id = order_id.id if order_id.kind_of?(GeoCerts::Order) [:order_id] = order_id build_collection(call_api { GeoCerts.api.order_events() }) { |response| response[:events][:event] } end |
+ (Object) find_by_order_id(order_id, options = {})
This method will not raise an exception for a missing order_id in the GeoCerts system. Instead, it will return an empty collection.
See GeoCerts::Event.find for more information.
59 60 61 62 63 |
# File 'lib/geo_certs/event.rb', line 59 def self.find_by_order_id(order_id, = {}) find(order_id, ) rescue GeoCerts::AllowableExceptionWithResponse [] end |