Class: PartnerService::Inventories::BlockService
- Inherits:
-
Object
- Object
- PartnerService::Inventories::BlockService
- Defined in:
- app/services/partner_service/inventories/block_service.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#restaurant_ids ⇒ Object
readonly
Returns the value of attribute restaurant_ids.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params, restaurant_ids) ⇒ BlockService
constructor
A new instance of BlockService.
- #message ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(params, restaurant_ids) ⇒ BlockService
Returns a new instance of BlockService.
5 6 7 8 9 10 |
# File 'app/services/partner_service/inventories/block_service.rb', line 5 def initialize(params, restaurant_ids) @params = params @restaurant_ids = restaurant_ids @errors = [] @success = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'app/services/partner_service/inventories/block_service.rb', line 3 def errors @errors end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/services/partner_service/inventories/block_service.rb', line 3 def params @params end |
#restaurant_ids ⇒ Object (readonly)
Returns the value of attribute restaurant_ids.
3 4 5 |
# File 'app/services/partner_service/inventories/block_service.rb', line 3 def restaurant_ids @restaurant_ids end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
3 4 5 |
# File 'app/services/partner_service/inventories/block_service.rb', line 3 def success @success end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/services/partner_service/inventories/block_service.rb', line 12 def call validate_params! return self unless errors.empty? process_restaurants self end |
#message ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/services/partner_service/inventories/block_service.rb', line 20 def if success? success.uniq.to_sentence else errors.uniq.to_sentence end end |
#success? ⇒ Boolean
28 29 30 |
# File 'app/services/partner_service/inventories/block_service.rb', line 28 def success? errors.blank? end |