Skip to content

Commit

Permalink
fix: improve Record.all
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Apr 19, 2021
1 parent 233ec60 commit 9f05760
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/dennis/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ class Record

class << self

def all(client, zone, type: nil, name: nil, query: nil, tags: nil, page: nil, per_page: nil)
def all(client, zone, **options)
request = client.api.create_request(:get, 'zones/:zone/records')
request.arguments[:zone] = zone
request.arguments[:name] = name if name
request.arguments[:type] = type if type
request.arguments[:query] = query if query
request.arguments[:tags] = tags if tags
request.arguments[:page] = page if page
request.arguments[:per_page] = per_page if per_page
options.each do |field, value|
request.arguments[field] = value
end
PaginatedArray.create(request.perform.hash, 'records') do |hash|
new(client, hash)
end
Expand Down

0 comments on commit 9f05760

Please sign in to comment.