Sha256: 660aa971e9098cf69cfd4028dbf72c9597a456e0acd39eb34a740923fe2997ce

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

class RealSavvy::Adapter::Collection < RealSavvy::Adapter::Base
  path_prefix_is 'collections'

  include RealSavvy::Concern::ShowForAdapter
  include RealSavvy::Concern::IndexForAdapter
  include RealSavvy::Concern::CreateForAdapter
  include RealSavvy::Concern::UpdateForAdapter
  include RealSavvy::Concern::DestroyForAdapter
  include RealSavvy::Concern::InvitesActionsForAdapter

  def add(id:, property_ids:)
    put("./api/v3/#{path_prefix}/#{id}/add", {property_ids: property_ids})
  end

  def remove(id:, property_ids:)
    delete("./api/v3/#{path_prefix}/#{id}/remove", {property_ids: property_ids})
  end

  def search(id:, market_id: nil, page_size: nil, page_number: nil, page: {}, sort: {}, filter: {})
    page[:size] ||= page_size
    page[:number] ||= page_number
    post("./api/v3/#{path_prefix}/#{id}/properties/search", {filter: filter, market_id: market_id, page: page, sort: sort})
  end

  def cluster(id:, market_id: nil, page_size: nil, page_number: nil, page: {}, sort: {}, filter: {}, precision: nil)
    page[:size] ||= page_size
    page[:number] ||= page_number
    post("./api/v3/#{path_prefix}/#{id}/properties/map/clusters", {filter: filter, market_id: market_id, page: page, sort: sort, precision: precision})
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
real_savvy-0.0.12 lib/real_savvy/adapter/collection.rb