Skip to content

Commit 75e564b

Browse files
author
marcel corso gonzalez
authored
Merge pull request #23 from joris/master
Wrapped List class inside MessageBird namespace (Solves issue #22)
2 parents 9691908 + 5ef9ed8 commit 75e564b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

lib/messagebird/list.rb

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22

33
require 'messagebird/base'
44

5-
class List < MessageBird::Base
6-
attr_accessor :offset, :limit, :count, :total_count, :links
7-
attr_reader :items
5+
module MessageBird
6+
class List < MessageBird::Base
7+
attr_accessor :offset, :limit, :count, :total_count, :links
8+
attr_reader :items
89

9-
# type will be used to create objects for the items, e.g.
10-
# List.new(Contact, {}).
11-
def initialize(type, json)
12-
@type = type
10+
# type will be used to create objects for the items, e.g.
11+
# List.new(Contact, {}).
12+
def initialize(type, json)
13+
@type = type
1314

14-
super(json)
15-
end
15+
super(json)
16+
end
1617

17-
def items=(value)
18-
@items = value.map { |i| @type.new i }
19-
end
18+
def items=(value)
19+
@items = value.map { |i| @type.new i }
20+
end
2021

21-
def [](index)
22-
@items[index]
22+
def [](index)
23+
@items[index]
24+
end
2325
end
24-
end
26+
end

0 commit comments

Comments
 (0)