Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions lib/messagebird/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@

require 'messagebird/base'

class List < MessageBird::Base
attr_accessor :offset, :limit, :count, :total_count, :links
attr_reader :items
module MessageBird
class List < MessageBird::Base
attr_accessor :offset, :limit, :count, :total_count, :links
attr_reader :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
end