Module: BWAPI::Client::Projects::Queries

Includes:
Backfill, DateRange, Mentions
Included in:
BWAPI::Client::Projects
Defined in:
lib/bwapi/client/projects/queries.rb,
lib/bwapi/client/projects/queries/backfill.rb,
lib/bwapi/client/projects/queries/mentions.rb,
lib/bwapi/client/projects/queries/date_range.rb

Defined Under Namespace

Modules: Backfill, DateRange, Mentions

Instance Method Summary collapse

Methods included from Mentions

#delete_query_mention, #get_query_mention_content, #update_query_mention

Methods included from DateRange

#create_date_range, #date_range, #date_ranges, #delete_date_range, #update_date_range

Methods included from Backfill

#backfills, #create_backfill, #delete_backfill, #get_backfill

Instance Method Details

#create_query(id, opts = {}) ⇒ Hashie::Mash

Create a new query in project

Parameters:

  • id (Integer)

    Id of project

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • id (String)

    Id of the query

  • name (String)

    Name of the project

  • dailyLimit (Integer)

    Daily limit of the query

  • twitterLimit (Integer)

    Twitter limit of the query

  • averageMonthlyMentions (Integer)

    Average monthly mentions

  • type (String)

    Query type

  • includedTerms (Array)

    Included terms of terms query

  • contextTerms (Array)

    Content terms of the query

  • excludedTerms (Array)

    Excluded terms of thequery

  • languages (Array)

    Query languages

  • twitterScreenName (String)

    Tracked twitter screen name

  • industry (String)

    Industry of the query

  • creationDate (Date)

    Date the query was created on

  • lastModificationDate (Date)

    Modification date of the query

Returns:

  • (Hashie::Mash)

    New query



55
56
57
# File 'lib/bwapi/client/projects/queries.rb', line 55

def create_query id, opts={}
  post "projects/#{id}/queries", opts
end

#delete_query(project_id, query_id) ⇒ Hashie::Mash

Delete an existing query project

Parameters:

  • project_id (Integer)

    Id of project

  • query_id (Integer)

    Id of query

Returns:

  • (Hashie::Mash)

    Deleted query



88
89
90
# File 'lib/bwapi/client/projects/queries.rb', line 88

def delete_query project_id, query_id
  delete "projects/#{project_id}/queries/#{query_id}"
end

#get_query(project_id, query_id) ⇒ Hashie::Mash Also known as: query

Get a specific query in project

Parameters:

  • project_id (Integer)

    Id of project

  • query_id (Integer)

    Id of query

Returns:

  • (Hashie::Mash)

    Specific query



31
32
33
# File 'lib/bwapi/client/projects/queries.rb', line 31

def get_query project_id, query_id
  get "projects/#{project_id}/queries/#{query_id}"
end

#queries(id) ⇒ Hashie::Mash

Get all queries in project

Parameters:

  • id (Integer)

    Id of project

Returns:

  • (Hashie::Mash)

    All queries in project



14
15
16
# File 'lib/bwapi/client/projects/queries.rb', line 14

def queries id
  get "projects/#{id}/queries"
end

#queries_summary(id) ⇒ Hashie::Mash

Get summary of all queries in project

Parameters:

  • id (Integer)

    Id of project

Returns:

  • (Hashie::Mash)

    Summary of all queries in project



22
23
24
# File 'lib/bwapi/client/projects/queries.rb', line 22

def queries_summary id
  get "projects/#{id}/queries/summary"
end

#update_query(project_id, query_id, opts = {}) ⇒ Hashie::Mash

Update an existing query in project

Parameters:

  • project_id (Integer)

    Id of project

  • query_id (Integer)

    Id of query

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • id (Integer)

    Id of the query

  • name (String)

    Name of the project

  • dailyLimit (Integer)

    Daily limit of the query

  • twitterLimit (Integer)

    Twitter limit of the query

  • averageMonthlyMentions (Integer)

    Average monthly mentions

  • type (String)

    Query type

  • includedTerms (Array)

    Included terms of terms query

  • contextTerms (Array)

    Content terms of the query

  • excludedTerms (Array)

    Excluded terms of thequery

  • languages (Array)

    Query languages

  • twitterScreenName (String)

    Tracked twitter screen name

  • industry (String)

    Industry of the query

  • creationDate (Date)

    Date the query was created on

  • lastModificationDate (Date)

    Modification date of the query

Returns:

  • (Hashie::Mash)

    Updated query



79
80
81
# File 'lib/bwapi/client/projects/queries.rb', line 79

def update_query project_id, query_id, opts={}
  put "projects/#{project_id}/queries/#{query_id}", opts
end