From 9a72f49a5db6f5c5876b977a81b5821db9ec9b70 Mon Sep 17 00:00:00 2001 From: Joris Machielse Date: Thu, 4 Oct 2018 19:45:10 -0400 Subject: [PATCH] Wrapped List class inside MessageBird namespace --- lib/messagebird/list.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/messagebird/list.rb b/lib/messagebird/list.rb index b9871ff..6e40d81 100644 --- a/lib/messagebird/list.rb +++ b/lib/messagebird/list.rb @@ -1,23 +1,23 @@ require 'messagebird/base' -class List < MessageBird::Base +module MessageBird + class List < MessageBird::Base + attr_accessor :offset, :limit, :count, :totalCount, :links, :items - attr_accessor :offset, :limit, :count, :totalCount, :links, :items + # type will be used to create objects for the items, e.g. + # List.new(Contact, {}). + def initialize(type, json) + @type = type - # type will be used to create objects for the items, e.g. - # List.new(Contact, {}). - def initialize(type, json) - @type = type + super(json) + end - super(json) - end - - def items=(value) - @items = value.map { |i| @type.new i } - end + def items=(value) + @items = value.map { |i| @type.new i } + end - def [](index) - @items[index] + def [](index) + @items[index] + end end - -end \ No newline at end of file +end