Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed marvel.creators.findByName function #9

Merged
merged 2 commits into from Feb 11, 2016

Conversation

kakakakakku
Copy link
Contributor

Hi, I found that marvel.creators.findByName function doesn't work.

  • Fetch by first name only : πŸ†–
  • Fetch by first and middle name only : πŸ†–
  • Fetch by first, middle, and last name : πŸ†—

Because, middleName and lastName are not allowed blank.

// debug code
console.log(response.statusCode); // 409
console.log(response.body); // { code: 409, status: 'lastName cannot be blank if it is set' }

After fixed

code

marvel.creators.findByName('austin')
  .then(console.log)
  .fail(console.error)
  .done();

marvel.creators.findByName('Goran', 'Sudzuka')
  .then(console.log)
  .fail(console.error)
  .done();

marvel.creators.findByName('Pat', 'Lee', '(X-Men/FF)')
  .then(console.log)
  .fail(console.error)
  .done();

result

{ data:
   [ { id: 2935,
       firstName: 'Austin',
       middleName: '',
       lastName: '',
       suffix: '',
       fullName: 'Austin',
       modified: '2007-01-02T00:00:00-0500',
       thumbnail: [Object],
       resourceURI: 'http://gateway.marvel.com/v1/public/creators/2935',
       comics: [Object],
       series: [Object],
       stories: [Object],
       events: [Object],
       urls: [Object] } ],
  meta: { offset: 0, limit: 20, total: 1, count: 1 } }
{ data:
   [ { id: 11479,
       firstName: 'Goran',
       middleName: 'Sudzuka',
       lastName: '',
       suffix: '',
       fullName: 'Goran Sudzuka',
       modified: '2011-10-03T17:17:54-0400',
       thumbnail: [Object],
       resourceURI: 'http://gateway.marvel.com/v1/public/creators/11479',
       comics: [Object],
       series: [Object],
       stories: [Object],
       events: [Object],
       urls: [Object] } ],
  meta: { offset: 0, limit: 20, total: 1, count: 1 } }
{ data:
   [ { id: 9215,
       firstName: 'Pat',
       middleName: 'Lee',
       lastName: '(X-Men/FF)',
       suffix: '',
       fullName: 'Pat Lee (X-Men/FF)',
       modified: '2007-01-02T00:00:00-0500',
       thumbnail: [Object],
       resourceURI: 'http://gateway.marvel.com/v1/public/creators/9215',
       comics: [Object],
       series: [Object],
       stories: [Object],
       events: [Object],
       urls: [Object] } ],
  meta: { offset: 0, limit: 20, total: 1, count: 1 } }

Fixed README.md

('austin', 'dave') and ('austin', 'dave', 'cam') parameters don't exist, so that fixed correct parameters.

Testing

➜  marvel-api git:(fix-creators) βœ— make test
  174 passing (454ms)

Thank you πŸ‘

@fiveisprime
Copy link
Owner

This is an amazing pull request. Thank you so much!

fiveisprime pushed a commit that referenced this pull request Feb 11, 2016
Fixed `marvel.creators.findByName` function
@fiveisprime fiveisprime merged commit db09c19 into fiveisprime:master Feb 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants