Class: Newslettre::Letter::Object

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/newslettre/letter.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/letter.rb', line 2

def data
  @data
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

#ownerObject

Returns the value of attribute owner

Returns:

  • (Object)

    the current value of owner



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

def owner
  @owner
end

Instance Method Details

#==(other) ⇒ Object



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

def == other
  self.to_hash == other
end

#deschedule!Object



26
27
28
# File 'lib/newslettre/letter.rb', line 26

def deschedule!
  scheduler.delete
end

#load_dataObject



12
13
14
# File 'lib/newslettre/letter.rb', line 12

def load_data
  self.data ||= request('get', :name => self.name).to_hash
end

#recipientsObject



42
43
44
# File 'lib/newslettre/letter.rb', line 42

def recipients
  @recipients ||= Newslettre::APIModuleProxy.new self, Recipients.new(self.name, self.api)
end

#scheduleObject



22
23
24
# File 'lib/newslettre/letter.rb', line 22

def schedule
  scheduler.get
end

#schedule!(options = {}) ⇒ Object



30
31
32
# File 'lib/newslettre/letter.rb', line 30

def schedule! options = {}
  scheduler.deliver options
end

#scheduled?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
# File 'lib/newslettre/letter.rb', line 34

def scheduled?
  begin
    !!schedule
  rescue NotScheduledFailure
    false
  end
end

#to_hashObject



16
17
18
19
20
# File 'lib/newslettre/letter.rb', line 16

def to_hash
  load_data

  data
end