Sha256: 398cbbefcef1101b39f5dc764b5d15d9515bafd9f387447d626876d013eae991

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 Bytes

Contents

module Mrkt
  module CrudActivities
    def get_activity_types
      get('/rest/v1/activities/types.json')
    end

    def get_paging_token(since_datetime)
      get('/rest/v1/activities/pagingtoken.json', sinceDatetime: since_datetime.iso8601)
    end

    def get_activities(next_page_token, activity_type_ids: [], lead_ids: [])
      params = {
        nextPageToken: next_page_token
      }

      params[:activityTypeIds] = activity_type_ids.join(',') unless blank?(activity_type_ids)
      params[:leadIds] = lead_ids.join(',') unless blank?(lead_ids)

      get('/rest/v1/activities.json', params)
    end

    def get_deleted_leads(next_page_token)
      get('/rest/v1/activities/deletedleads.json', nextPageToken: next_page_token)
    end

    private

    def blank?(value)
      !value || value == '' || value.empty?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mrkt-1.0.0 lib/mrkt/concerns/crud_activities.rb
mrkt-0.11.1 lib/mrkt/concerns/crud_activities.rb
mrkt-0.11.0 lib/mrkt/concerns/crud_activities.rb
mrkt-0.10.0 lib/mrkt/concerns/crud_activities.rb