Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1062DE864 for ; Fri, 22 Feb 2013 23:53:08 +0000 (UTC) Received: (qmail 50847 invoked by uid 500); 22 Feb 2013 23:53:07 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 50833 invoked by uid 500); 22 Feb 2013 23:53:07 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 50824 invoked by uid 99); 22 Feb 2013 23:53:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2013 23:53:07 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lutter@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2013 23:53:02 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1MNqgmD031927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 22 Feb 2013 18:52:42 -0500 Received: from avon.watzmann.net ([10.3.112.12]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1MNqdjM026300 for ; Fri, 22 Feb 2013 18:52:41 -0500 From: lutter@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH 2/9] CIMI: Added ref_id helper to Base class Date: Fri, 22 Feb 2013 15:52:25 -0800 Message-Id: <1361577152-13510-3-git-send-email-lutter@redhat.com> In-Reply-To: <1361577152-13510-1-git-send-email-lutter@redhat.com> References: <1361577152-13510-1-git-send-email-lutter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Virus-Checked: Checked by ClamAV on apache.org From: Michal Fojtik The ref_id(url) will extract the last segment of the URL and return it as an 'id'. FIXME: We should use ctx to return the ID of resource properly. Signed-off-by: Michal fojtik TrackedAt: http://tracker.deltacloud.org/patch/90eb17744273b3e64b01808f7692fe57c4cff097 --- server/lib/cimi/models/base.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb index 2e3351d..e7fd358 100644 --- a/server/lib/cimi/models/base.rb +++ b/server/lib/cimi/models/base.rb @@ -165,6 +165,10 @@ module CIMI::Model property.merge!(h) end + def ref_id(ref_url) + ref_url.split('/').last if ref_url + end + private # Load an existing database entity for this object, or create a new one -- 1.8.1.2