Class: Spaceship::Tunes::SandboxTester

Inherits:
TunesBase show all
Defined in:
spaceship/lib/spaceship/tunes/sandbox_tester.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Subclasses collapse

Class Method Summary collapse

Methods inherited from TunesBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#countryString

Returns The two-letter country code of this tester.

Examples:

"US"

Returns:

  • (String)

    The two-letter country code of this tester



24
25
26
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 24

def country
  @country
end

#emailString

Returns The email of this sandbox tester.

Examples:

"[email protected]"

Returns:

  • (String)

    The email of this sandbox tester



9
10
11
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 9

def email
  @email
end

#first_nameString

Returns The first name of this tester.

Examples:

"Cary"

Returns:

  • (String)

    The first name of this tester



14
15
16
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 14

def first_name
  @first_name
end

#last_nameString

Returns The last name of this tester.

Examples:

"Bennett"

Returns:

  • (String)

    The last name of this tester



19
20
21
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 19

def last_name
  @last_name
end

Class Method Details

.allObject



41
42
43
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 41

def self.all
  client.sandbox_testers(self).map { |tester| self.new(tester) }
end

.create!(email: nil, password: nil, first_name: 'Test', last_name: 'Test', country: 'US') ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 45

def self.create!(email: nil, password: nil, first_name: 'Test', last_name: 'Test', country: 'US')
  data = client.create_sandbox_tester!(
    tester_class: self,
    email: email,
    password: password,
    first_name: first_name,
    last_name: last_name,
    country: country
  )
  self.new(data)
end

.delete!(emails) ⇒ Object



57
58
59
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 57

def self.delete!(emails)
  client.delete_sandbox_testers!(self, emails)
end

.delete_all!Object



61
62
63
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 61

def self.delete_all!
  delete!(self.all.map(&:email))
end

.urlObject



33
34
35
36
37
38
39
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 33

def self.url
  {
    index:  "ra/users/iap",
    create: "ra/users/iap/add",
    delete: "ra/users/iap/delete"
  }
end

Instance Method Details

#delete!Object

Delete current tester



69
70
71
# File 'spaceship/lib/spaceship/tunes/sandbox_tester.rb', line 69

def delete!
  client.delete_tester!(self)
end