Created
December 11, 2012 16:59
-
-
Save jbritten/4260275 to your computer and use it in GitHub Desktop.
Creating Testers via the Prefinery API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attr_accessible :invitation_code | |
attr_accessor :invitation_code | |
before_validation :validate_invitation_code, :on => :create | |
def validate_invitation_code | |
tester = Prefinery::Tester.new(:beta_id => YOUR_BETA_ID) | |
tester.email = self.email | |
tester.invitation_code = self.invitation_code | |
tester.status = 'active' | |
if !tester.save | |
errors.add(:invitation_code, "is invalid") | |
false | |
end | |
true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prefinery.configure do |config| | |
config.subdomain = 'YOUR_ACCOUNT_SUBDOMAIN' | |
config.api_key = 'YOUR_API_KEY' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'prefinery' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment