Class: Workarea::Shipping::LocationQuery
- Inherits:
-
Object
- Object
- Workarea::Shipping::LocationQuery
- Defined in:
- app/models/workarea/shipping/location_query.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
Instance Method Summary collapse
-
#initialize(services, country, region) ⇒ LocationQuery
constructor
A new instance of LocationQuery.
- #location_services ⇒ Object
Constructor Details
#initialize(services, country, region) ⇒ LocationQuery
Returns a new instance of LocationQuery.
6 7 8 9 10 |
# File 'app/models/workarea/shipping/location_query.rb', line 6 def initialize(services, country, region) @services = services @country = typecast_country(country) @region = region end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
4 5 6 |
# File 'app/models/workarea/shipping/location_query.rb', line 4 def country @country end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
4 5 6 |
# File 'app/models/workarea/shipping/location_query.rb', line 4 def region @region end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
4 5 6 |
# File 'app/models/workarea/shipping/location_query.rb', line 4 def services @services end |
Instance Method Details
#location_services ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/workarea/shipping/location_query.rb', line 12 def location_services location_services = matching_services if has_service_with_region? location_services.select! do |service| service.regions.include?(region) end end location_services end |