hspinks / omniauth-ihealth

NOT ACTIVELY MAINTAINED - an OmniAuth strategy for iHealth
3 stars 4 forks source link

NoMethodError #3

Open tommybernaciak opened 9 years ago

tommybernaciak commented 9 years ago

I am getting error each time I try to connect to api: NoMethodError (undefined method 'downcase' for nil:NilClass): (/lib/omniauth/strategies/ihealth.rb:71:in `user_data').

the problem is here:

def user_data
  info = raw_info
  user_data ||= {
   :name => info["nickname"],
   :gender => info["gender"].downcase,
   :birthday => Time.at(info["dateofbirth"]).to_date.strftime("%Y-%m-%d"),
   :image => URI.unescape(info["logo"]),
   :nickname => info["nickname"],
   :height => calc_height(info["height"], info["HeightUnit"]),
   :weight => calc_weight(info["weight"], info["WeightUnit"])
  }
end

So probably I am receiving empty array in response, or no array at all.

tim-shaker commented 9 years ago

@tommy7xo did you ever resolve this issue?

tommybernaciak commented 9 years ago

I finally made a connection to ihealth but I created my own service to do that.

tim-shaker commented 9 years ago

@tommy7xo could you possibly make it open source?

tommybernaciak commented 9 years ago

Yeah, thats the plan, but cant tell you exactly when it gonna happen

tim-shaker commented 9 years ago

alright, thanks!

hspinks commented 9 years ago

@tommy7xo & @tshaker I've just opened a PR that addresses the specific bug reported here - #4

It definitely does not guarantee that this gem is most up to date with the iHealth API, but should at least stop the error reported here. In only the most cursory of tests, I was still able to use this to log in and get data back. Please feel free to add onto this PR or submit your own to address this issue - let me know if you're planning on doing so and I'll wait to merge #4