Sha256: b6c2b4045b963df89643f59ff100ba9f1f68a78240a34b7f5af4d90b213eafe8

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require 'epom/epom_element'

module Epom
  class Advertiser < EpomElement

    def self.extended_methods
      {
          :delete_advertiser => {
              :url => '/rest-api/advertisers/ADVERTISER_ID/delete.do',
              :url_parameters => [:advertiserId],
              :body_parameters => [:hash, :timestamp, :username],
              :method => :delete
          },
          :get_advertiser_permissions_for_user => {
              :url => '/rest-api/advertiserShares.do',
              :body_parameters => [:hash, :timestamp, :username],
              :method => :get
          },
          :get_campaigns_for_advertiser => {
              :url => '/rest-api/advertiser/ADVERTISER_ID/campaigns.do',
              :url_parameters => [:advertiserId],
              :body_parameters => [:hash, :timestamp, :username],
              :method => :get
          },
          :update_advertiser => {
              :url => '/rest-api/advertisers/update.do',
              :body_parameters => [:id, :name, :contactName, :contactEmail, :description, :categoryId, :hash, :timestamp, :username],
              :method => :put
          },
          :create_advertiser => {
              :url => '/rest-api/advertisers/update.do',
              :body_parameters => [:name, :contactName, :contactEmail, :description, :categoryId, :hash, :timestamp, :username],
              :method => :put
          },

      }
    end

    def self.replace_params_in_url(url, url_params)
      url.gsub!('ADVERTISER_ID', url_params[:advertiserId].to_s) if url.include?('ADVERTISER_ID')
      url
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epom-0.5 lib/epom/advertiser.rb