Class: Pinterest::Resources::Audiences

Inherits:
Base
  • Object
show all
Defined in:
lib/pinterest/resources/audiences.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Pinterest::Resources::Base

Instance Method Details

#create(ad_account_id:, **params) ⇒ Hash

Parameters:

  • ad_account_id (String)
  • params (Hash)

    audience attributes (ad_account_id, audience_type, name, rule, …)

Returns:

  • (Hash)


7
8
9
# File 'lib/pinterest/resources/audiences.rb', line 7

def create(ad_account_id:, **params)
  post("/ad_accounts/#{}/audiences", params)
end

#find(ad_account_id:, audience_id:) ⇒ Hash

Parameters:

  • ad_account_id (String)
  • audience_id (String)

Returns:

  • (Hash)


28
29
30
# File 'lib/pinterest/resources/audiences.rb', line 28

def find(ad_account_id:, audience_id:)
  get("/ad_accounts/#{}/audiences/#{audience_id}")
end

#list(ad_account_id:, bookmark: nil, page_size: nil, order: nil, ownership_type: nil, exclude_nca: nil) ⇒ Hash

Returns { “items” => […], “bookmark” => “…” }.

Parameters:

  • ad_account_id (String)
  • bookmark (String, nil) (defaults to: nil)
  • page_size (Integer, nil) (defaults to: nil)
  • order (String, nil) (defaults to: nil)

    “ASCENDING” or “DESCENDING”

  • ownership_type (String, nil) (defaults to: nil)

    “OWNED” or “RECEIVED”

  • exclude_nca (Boolean, nil) (defaults to: nil)

Returns:

  • (Hash)

    { “items” => […], “bookmark” => “…” }



18
19
20
21
22
23
# File 'lib/pinterest/resources/audiences.rb', line 18

def list(ad_account_id:, bookmark: nil, page_size: nil, order: nil,
         ownership_type: nil, exclude_nca: nil)
  get("/ad_accounts/#{}/audiences",
      { bookmark: bookmark, page_size: page_size, order: order,
        ownership_type: ownership_type, exclude_nca: exclude_nca }.compact)
end

#update(ad_account_id:, audience_id:, **params) ⇒ Hash

Parameters:

  • ad_account_id (String)
  • audience_id (String)
  • params (Hash)

    fields to update

Returns:

  • (Hash)


36
37
38
# File 'lib/pinterest/resources/audiences.rb', line 36

def update(ad_account_id:, audience_id:, **params)
  patch("/ad_accounts/#{}/audiences/#{audience_id}", params)
end