Class: Bnb::All

Inherits:
Object
  • Object
show all
Defined in:
lib/bnb/resources/all.rb

Constant Summary collapse

ALL_LIMIT =
7

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ All

Returns a new instance of All.



7
8
9
10
# File 'lib/bnb/resources/all.rb', line 7

def initialize(params = {})
  @start = params.fetch(:start, 1)
  @limit = params.fetch(:limit, ALL_LIMIT)
end

Instance Method Details

#listObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/bnb/resources/all.rb', line 12

def list
  url = Bnb::Base.send(:build_url, '/listings/latest')
  options = OpenStruct.new(http_method: 'get', url: url,
                           headers: { 'Content-Type' => 'application/json' }, data: {},
                           params: {
                            start: @start, limit: @limit
                           }, auth: nil, proxy: nil, options: {})

  Request::Client.request(options)
end