Skip to content

MTG::Card.all fails - undefined method call for Date:Class #13

Description

@hslzr

Without changing the api_version to 2 I get:

3.2.0 :001 > require 'mtg_sdk'
 => true
3.2.0 :002 > MTG::Card.all
/Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/coercion.rb:15:in `call': undefined method `call' for Date:Class (NoMethodError)

        @type.call(input)
             ^^^^^
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:19:in `evaluate'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:10:in `block in call'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:9:in `each'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:9:in `inject'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:9:in `call'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/deserializer.rb:87:in `block in <module:Representable>'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:19:in `evaluate'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:10:in `block in call'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:9:in `each'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:9:in `inject'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/pipeline.rb:9:in `call'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/binding.rb:55:in `uncompile_fragment'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/binding.rb:14:in `block in call'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/binding.rb:12:in `each'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable/binding.rb:12:in `call'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/representable-3.2.0/lib/representable.rb:68:in `representable_map!'

After that, I get...

3.2.0 :003 > MTG.configure do |config|
3.2.0 :004 >   config.api_version = 2
3.2.0 :005 > end
 => 2
3.2.0 :006 > MTG::Card.all
/Users/salazar/.rvm/gems/ruby-3.2.0/gems/mtg_sdk-3.2.1/lib/mtg_sdk/query_builder.rb:53:in `all': undefined method `empty?' for nil:NilClass (NoMethodError)

        if !data.empty?
                ^^^^^^^
	from /Users/salazar/.rvm/gems/ruby-3.2.0/gems/mtg_sdk-3.2.1/lib/mtg_sdk/card.rb:33:in `all'
	from (irb):6:in `<main>'
	from /Users/salazar/.rvm/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/bin/irb:25:in `load'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/bin/irb:25:in `<main>'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/bin/ruby_executable_hooks:22:in `eval'
	from /Users/salazar/.rvm/gems/ruby-3.2.0/bin/ruby_executable_hooks:22:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions