Class: Spree::Api::V3::Admin::DashboardAnalyticsSerializer
- Inherits:
-
Object
- Object
- Spree::Api::V3::Admin::DashboardAnalyticsSerializer
- Defined in:
- app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#time_range ⇒ Object
readonly
Returns the value of attribute time_range.
Instance Method Summary collapse
-
#initialize(store:, currency:, time_range:, params: {}) ⇒ DashboardAnalyticsSerializer
constructor
A new instance of DashboardAnalyticsSerializer.
- #to_h ⇒ Object
Constructor Details
#initialize(store:, currency:, time_range:, params: {}) ⇒ DashboardAnalyticsSerializer
Returns a new instance of DashboardAnalyticsSerializer.
8 9 10 11 12 13 |
# File 'app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb', line 8 def initialize(store:, currency:, time_range:, params: {}) @store = store @currency = currency @time_range = time_range @params = params end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
6 7 8 |
# File 'app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb', line 6 def currency @currency end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb', line 6 def params @params end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
6 7 8 |
# File 'app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb', line 6 def store @store end |
#time_range ⇒ Object (readonly)
Returns the value of attribute time_range.
6 7 8 |
# File 'app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb', line 6 def time_range @time_range end |
Instance Method Details
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/serializers/spree/api/v3/admin/dashboard_analytics_serializer.rb', line 15 def to_h { currency: currency, date_from: time_range.first.iso8601, date_to: time_range.last.iso8601, summary: summary, chart_data: chart_data, top_products: top_products } end |