Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Aug 08, 2011 11:47 pm 
Offline
Senior Newbie

Joined: Fri Aug 05, 2011 6:15 am
Posts: 15
[Note: The following has just been fixed in the latest version, 0.7.3]

I wasn't able to find anything about this in the documentation nor on the forum however after extensive Googling I came to a solution so I figured in the interests of all members I would post it to the forum so maybe the solution will be easier to find.

It appears that the Ruby Binding for the Linode API has a bug with ruby 1.8.7. Those using ruby 1.8.7 will not be able to read any data record with the name "type".

For example domain.resource.list returns a list of dns records as object type OpenStruct. One of the sub-records returned for each dns record is "type", however ruby 1.8.7 cannot read the value.

Trying to do so:

puts record.type

Results in the following error:

Code:
openstruct warning: Object#type is deprecated; use Object#class


There are two solutions to this problem; 1) Upgrade to ruby 1.9, it appears OpenStruct doesn't suffer from the bug then, or 2) add the following line of code near the top of your script, just under your require statements.

Code:
OpenStruct.__send__(:define_method, :type) { @table[:type] }


That gets rid of the bug and you will be able to read the type of record without problem.

Hope this helps someone, cheers.
-Musfuut


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group