Sha256: 9323798d9ae04cdcf7c1c8fa55a3c4e203de0b71c587264a258f782f2740af26

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

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

    def get_paging_token(since_datetime)
      params = {
        sinceDatetime: since_datetime.iso8601
      }
      get("/rest/v1/activities/pagingtoken.json", params)
    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

    private

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mrkt-0.9.0 lib/mrkt/concerns/crud_activities.rb
mrkt-0.8.0 lib/mrkt/concerns/crud_activities.rb