Class: HasOffers::Offer

Inherits:
Base
  • Object
show all
Defined in:
lib/hasoffers/offer.rb

Constant Summary collapse

Target =
'Offer'

Class Method Summary collapse

Methods inherited from Base

api_mode, api_mode=, base_uri, base_uri=, get_request, initialize_credentials, live?, post_request, requires!, test?

Class Method Details

.create(data, return_object = false) ⇒ Object


9
10
11
12
13
# File 'lib/hasoffers/offer.rb', line 9

def create(data, return_object = false)
  requires!(data, %w[name description advertiser_id offer_url preview_url protocol status expiration_date])
  params = build_data data, return_object
  post_request(Target, 'create', params)
end

.update(id, data, return_object = false) ⇒ Object


15
16
17
18
19
# File 'lib/hasoffers/offer.rb', line 15

def update(id, data, return_object = false)
  params = build_data data, return_object
  params['id'] = id
  post_request(Target, 'update', params)
end