accodeing / fortnox-api

Gem that abstracts Fortnox's F3 API
GNU Lesser General Public License v3.0
9 stars 8 forks source link

Find with hash will crash the gem #96

Closed ehannes closed 7 years ago

ehannes commented 7 years ago

fund_all_by is called but not implemented:

# lib/fortnox/api/repositories/base/loaders.rb
  def find( id_or_hash )
    return find_all_by( id_or_hash ) if id_or_hash.is_a? Hash
    ...
  end

  ...

  # def find_all_by( hash )

  # end
ehannes commented 7 years ago

Possible fix by @d-Pixie

def find_all_by( hash )
  response_hash = get( "#{ self.class::URI }?#{ to_query( hash )}" )
  instantiate( @mapper.wrapped_json_hash_to_entity_hash( response_hash ) )
end