Class: Gobbler::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/gobbler/project.rb

Overview

Projects that you have backed up with Gobbler

Instance Attribute Summary

Attributes inherited from Base

#json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#base_attr, get, #initialize

Constructor Details

This class inherits a constructor from Gobbler::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gobbler::Base

Class Method Details

.list(opts = {}) ⇒ Array<Project>

Returns an array of Gobbler Projects.

Returns:

  • (Array<Project>)

    an array of Gobbler Projects



16
17
18
19
# File 'lib/gobbler/project.rb', line 16

def self.list(opts = {})
  opts[:offset] ||= 0
  ::Gobbler.request("client_project/sync_ask", options: opts)["updates"].map {|project| new(project)}
end

Instance Method Details

#checkpointsArray<Checkpoint>

Returns an array of Checkpoints for this project.

Returns:

  • (Array<Checkpoint>)

    an array of Checkpoints for this project



28
29
30
31
32
# File 'lib/gobbler/project.rb', line 28

def checkpoints
  (1..current_checkpoint["num"]).map do |checkpoint_num|
   ::Gobbler::Checkpoint.get(project_id: guid, checkpoint: checkpoint_num)
  end
end

#email_to(recipients, opts = {}) ⇒ Hash

Returns The information about the email sent.

Returns:

  • (Hash)

    The information about the email sent



35
36
37
38
39
40
# File 'lib/gobbler/project.rb', line 35

def email_to(recipients, opts = {})
  params = {guid: guid, recipients: recipients}
  params[:is_public] = opts[:public] if opts[:public] == true
  params[:checkpoint] = opts[:checkpoint] if opts[:checkpoint]
  ::Gobbler.request("client_mailbox/send_project", params)
end

#last_checkpointCheckpoint

Get the last checkpoint for a project

Returns:



23
24
25
# File 'lib/gobbler/project.rb', line 23

def last_checkpoint
  ::Gobbler::Checkpoint.get(project_id: guid, checkpoint: current_checkpoint["num"])
end