module Delicious::Bundles::Methods::Find

Public Instance Methods

find(name) click to toggle source

Find a bundle with given name

@param name [String] Bundle name @return [Bundle, nil] Found bundle or ‘nil` if it was not found

# File lib/delicious/bundles/methods/find.rb, line 14
def find(name)
  response = @client.connection.get '/v1/tags/bundles/all', bundle: name
  bundle = response.body['bundles']['bundle']
  Bundle.build_persisted @client, self.class.model_attrs(bundle)
rescue Faraday::ParsingError => e
  # it's ridiculous, but delicious returns invalid XML response when bundle is missing
  nil
end