Class: Newslettre::Lists::Object

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/newslettre/lists.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



2
3
4
# File 'lib/newslettre/lists.rb', line 2

def data
  @data
end

#listObject

Returns the value of attribute list

Returns:

  • (Object)

    the current value of list



2
3
4
# File 'lib/newslettre/lists.rb', line 2

def list
  @list
end

#ownerObject

Returns the value of attribute owner

Returns:

  • (Object)

    the current value of owner



2
3
4
# File 'lib/newslettre/lists.rb', line 2

def owner
  @owner
end

Instance Method Details

#==(other) ⇒ Object



8
9
10
# File 'lib/newslettre/lists.rb', line 8

def == other
  self.to_hash == other
end

#emailsObject



24
25
26
# File 'lib/newslettre/lists.rb', line 24

def emails
  @emails ||= Newslettre::APIModuleProxy.new self, Email.new(self.list, self.api)
end

#load_dataObject



12
13
14
15
16
# File 'lib/newslettre/lists.rb', line 12

def load_data
  loaded = request('get', :list => self.list).first
  raise Newslettre::API::ClientFailure, "missing #{self.list}" if loaded.nil?
  self.data ||= loaded.to_hash
end

#to_hashObject



18
19
20
21
22
# File 'lib/newslettre/lists.rb', line 18

def to_hash
  load_data

  data
end