Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:08:21+00:00 2026-06-16T00:08:21+00:00

I think this is pretty straightforward but I’ve been trying for days without a

  • 0

I think this is pretty straightforward but I’ve been trying for days without a solution. Everything I’ve tried returned errors. Hope to get some help here.

First of all, I am using this gemfile here :

https://github.com/ryanwkan/covetous

After initializing with a VALID tagID(rwk#1242)

@temp = Covetous::Profile::Career.new ‘rwk#1242’

I get a return object like this

http://pastebin.com/CcW0aaLL

Top portion of the object looks like this:

#<Covetous::Profile::Career:0x000001014284c8 @url="http://us.battle.net/api/d3/profile/rwk-1242/", @response=#<HTTParty::Response:0x102e69ff8 parsed_response={"heroes"=>[{"name"=>"Ziyi", "id"=>10692899, "level"=>60, "hardcore"=>false, "paragonLevel"=>87, "gender"=>1, "dead"=>false, "class"=>"wizard", "last-updated"=>1354337248}, {"name"=>"Aerendil", etc ...

And if I initialize with an INVALID tagID(invalid#9999)

@temp = Covetous::Profile::Career.new ‘invalid#9999’

I get a return object like this:

#<Covetous::Profile::Career:0x00000100dfbcf8 @url="http://us.battle.net/api/d3/profile/invalid-9999/", @response=#<HTTParty::Response:0x100d96a88 parsed_response={"code"=>"OOPS", "reason"=>"There was a problem processing the request."}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"date"=>["Tue, 18 Dec 2012 02:30:00 GMT"], "server"=>["Apache"], "x-frame-options"=>["SAMEORIGIN"], "content-language"=>["en-US"], "vary"=>["Accept-Encoding"], "connection"=>["close"], "transfer-encoding"=>["chunked"], "content-type"=>["application/json;charset=UTF-8"]}>>

I need to flash an error message whenever an invalid tag is given.

Question is, how should I know if I got a valid response or an invalid response?

I’ve tried checking if the response for the key ‘code’ or ‘heroes’ but it only works when the key is available, else I get a NoMethodError. Is there any way to test for the presence of a key, returning true/ false?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:08:22+00:00Added an answer on June 16, 2026 at 12:08 am

    If asking for code or heroes is known to give you a NoMethodError on the occasions you are looking for, just wrap that call in a begin/end block and catch the error with rescue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this is a pretty straightforward problem but... var outerHeight = $('.profile').outerHeight(); $(#total-height).text(outerHeight
Okay at first I thought this would be pretty straightforward. But I can't think
I'm trying to do something that I think should be pretty straightforward but I
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this is a pretty basic question, but after Googling around I can't
I know similar questions have been asked before, but I think my solution is
i think this is a pretty straight forward problem , but i still can
I think what I want to do is pretty straightforward, but it isn't for
Pretty straightforward. I think I have what should be a unique selector, but in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.