Class: Lce::Offer

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/lce/offer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(id) ⇒ Object



5
6
7
8
# File 'lib/lce/offer.rb', line 5

def find(id)
  response = Lce.client.get('offers', id)
  new(response)
end

Instance Method Details

#available_delivery_locations(params) ⇒ Object



17
18
19
20
21
22
# File 'lib/lce/offer.rb', line 17

def available_delivery_locations(params)
  return [] unless product.preset_delivery_location == true
  Lce.client.get('offers', id, 'available_delivery_locations', nil , {location: params }).map! do |l|
    Hashie::Mash.new(l)
  end
end

#place_order(params) ⇒ Object



12
13
14
15
# File 'lib/lce/offer.rb', line 12

def place_order(params)
  params.merge!(offer_id: id)
  Order.place(params)    
end