canvas-api icon indicating copy to clipboard operation
canvas-api copied to clipboard

GETing term does not have more? defined

Open eriko opened this issue 10 years ago • 6 comments

I have more than 10 terms and looking at the raw returns in a rest client the 'next' and 'last' links are being returned. I can manually use them but not on the results of: raw_terms = canvas.get("/api/v1/accounts/1/terms",{'workflow_state'=>'active'}) raw_terms.more? NoMethodError: undefined method 'more?' for #<Hash:0x007fc553935100>

Any thoughts? It seems like it should be returning ResultSet < Array and not a Hash

eriko avatar May 19 '14 23:05 eriko

Nor can you call more? on the array inside the hash.
raw_terms['enrollment_terms'].more?

eriko avatar May 19 '14 23:05 eriko

This is on the current version of the gem. I am though using 1.0 due to the issue I mentioned in #7 .

[4] pry(Term)> raw_terms['enrollment_terms'].more? NoMethodError: undefined method more?' for #<Array:0x007fecf30d32b0> from (pry):4:inimport_xml'

eriko avatar May 28 '14 01:05 eriko

@darrencauthon I have the same issues when trying to get quiz results and unable to use any of your Array extensions for more, next etc due to this line here resulting in a hash and not an array.

I'm querying something like /api/v1/courses/873225/quizzes/792241/submissions. The resulting JSON if queried outside of this gem is

{
  quiz_submissions: [
    {...},
    {...}
  ]
}

And just to add, a simple json = json["quiz_submissions"].to_a just before this line makes it all work fine, obviously not a solution, maybe Canvas changed their API since you created this gem.

Nogbit avatar Jan 09 '15 18:01 Nogbit

I'll take a look...

darrencauthon avatar Jan 09 '15 18:01 darrencauthon

... and I took a look.

That wasn't my code, my only contribution so far was an update to a test file. :smile:

darrencauthon avatar Jan 09 '15 18:01 darrencauthon

Ooops, Im sorry, I meant @whitmer

Nogbit avatar Jan 09 '15 18:01 Nogbit