lib/spaceship/tunes/tester.rb in spaceship-0.34.1 vs lib/spaceship/tunes/tester.rb in spaceship-0.34.2

- old
+ new

@@ -186,7 +186,59 @@ # @param app_id (String) (required): The id of the application to which want to modify the list def remove_from_app!(app_id) client.remove_tester_from_app!(self, app_id) end end + + class SandboxTester < TunesBase + # @return (String) The email of this tester + # @example + # "tester@spaceship.com" + attr_accessor :email + + # @return (String) The first name of this tester + # @example + # "Cary" + attr_accessor :first_name + + # @return (String) The last name of this tester + # @example + # "Bennett" + attr_accessor :last_name + + # @return (String) The two-letter country code of this tester + # @example + # "US" + attr_accessor :country + + attr_mapping( + 'emailAddress.value' => :email, + 'firstName.value' => :first_name, + 'lastName.value' => :last_name, + 'storeFront.value' => :country + ) + + def self.url + { + index: "ra/users/iap", + create: "ra/users/iap/add" + } + end + + def self.all + client.sandbox_testers(self).map { |tester| self.new(tester) } + end + + 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 + end end end