1

我正在使用一个名为Desk的 gem从desk.com 的 API 返回数据。当我运行Desk.customers(:custom_external_id => temp.id)它时,它会返回一组可爱的数据。

我正在寻找整数 71095620 从id=71095620.

   => #<Hashie::Rash count=20 page=1 results=[#<Hashie::Rash customer=#<Hashie::Rash addresses=[] custom_external_id="58749" emails=[#<Hashie::Rash email=#<Hashie::Rash created_at="2013-02-13T15:59:26-08:00" email="CENSORED" i
d=33622514 updated_at="2013-02-13T15:59:26-08:00" verified_at=nil>>] first_name="CENSORED" id=68712186 language=nil last_name="CENSORED" phones=[#<Hashie::Rash phone=#<Hashie::Rash created_at="2013-02-13T16:00:45-08:00" id=1301079 phone="CENSORED" updated_at="2013-02-13T16:00:45-08:00">>] twitters=[nil]>>, #<Hashie::Rash customer=#<Hashie::Rash addresses=[] custom_external_id="58749"  emails=[] first_name="CENSORED" id=71095620 language=nil last_name="CENSORED" phones=[] twitters=[nil]>>] total=2> 

这显然有多个 id 字段,我不确定哪种方法最好提取该整数。提前致谢!

4

1 回答 1

2

根据Hasie::Rash 自述文件,您可能可以这样做

response = Desk.customers(:custom_external_id => temp.id)
response.results[1].customer.id
于 2013-02-27T03:11:00.303 回答