Class: ConvertLoop::Person
- Inherits:
-
Object
- Object
- ConvertLoop::Person
- Defined in:
- lib/convertloop/person.rb
Instance Method Summary collapse
- #create_or_update(args = {}) ⇒ Object
-
#initialize(client) ⇒ Person
constructor
A new instance of Person.
Constructor Details
#initialize(client) ⇒ Person
Returns a new instance of Person.
3 4 5 6 7 |
# File 'lib/convertloop/person.rb', line 3 def initialize(client) puts "Client: #{client}" raise RuntimeError, "No client provided" if client.nil? @client = client end |
Instance Method Details
#create_or_update(args = {}) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/convertloop/person.rb', line 9 def create_or_update(args={}) raise ArgumentError, "No args provided" if args.nil? if args[:pid].nil? && args[:user_id].nil? && args[:email].nil? raise ArgumentError, "You must supply at least one of the following keys: ':pid' (to update), or ':user_id' and/or ':email' (to create or update)" end @client.post("/people", args) end |