lib/myjohndeere/requestable.rb in myjohndeere-0.1.4 vs lib/myjohndeere/requestable.rb in myjohndeere-0.1.5

- old
+ new

@@ -9,9 +9,13 @@ if !self.access_token.nil? && !self.access_token.is_a?(approved_class) then raise ArgumentError.new("Expected a #{approved_class}, do not know how to handle #{self.access_token.class}") end end + def has_access_to?(rel_link_name) + self.links.any? {|i| i["rel"] == rel_link_name} + end + def extract_link_with_rel_from_list(rel_target, regex_to_capture_item) link = self.links.detect { |l| l["rel"] == rel_target } if link then return regex_to_capture_item.match(link["uri"])[1] else \ No newline at end of file