From b43ecca9060b3d7ffd84d700caecf5f35fd403a9 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Tue, 11 Apr 2017 22:34:59 -0300 Subject: Add basic representations for the Github API results --- lib/github/representation/milestone.rb | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/github/representation/milestone.rb (limited to 'lib/github/representation/milestone.rb') diff --git a/lib/github/representation/milestone.rb b/lib/github/representation/milestone.rb new file mode 100644 index 00000000000..5ea54eb178f --- /dev/null +++ b/lib/github/representation/milestone.rb @@ -0,0 +1,37 @@ +module Github + module Representation + class Milestone < Representation::Base + def iid + raw['number'] + end + + def title + raw['title'] + end + + def description + raw['description'] + end + + def due_date + raw['due_on'] + end + + def state + raw['state'] == 'closed' ? 'closed' : 'active' + end + + def url + raw['url'] + end + + def created_at + raw['created_at'] + end + + def updated_at + raw['updated_at'] + end + end + end +end -- cgit v1.2.1 From f35573f12eb579b31b014fa99509c694021c33c7 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Wed, 19 Apr 2017 19:14:40 -0300 Subject: Extract common attributes to Github::Representation::Base --- lib/github/representation/milestone.rb | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lib/github/representation/milestone.rb') diff --git a/lib/github/representation/milestone.rb b/lib/github/representation/milestone.rb index 5ea54eb178f..917e6394ad4 100644 --- a/lib/github/representation/milestone.rb +++ b/lib/github/representation/milestone.rb @@ -20,18 +20,6 @@ module Github def state raw['state'] == 'closed' ? 'closed' : 'active' end - - def url - raw['url'] - end - - def created_at - raw['created_at'] - end - - def updated_at - raw['updated_at'] - end end end end -- cgit v1.2.1