Sha256: 0ccb52799bc3b71d59e2b08e419e96f57b1eeca1851045177f04bcf1fb203b39
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'multi_json' module Sellsy class Contact attr_accessor :id attr_accessor :name, :thirdid, :forename, :email, :position def create command = { 'method' => 'Peoples.create', 'params' => { 'people' => { 'name' => @name, 'forename' => @forename, 'email' => @email, 'position' => @position, 'thirdids' => [@thirdid] } } } response = MultiJson.load(Sellsy::Api.request command) @id = response['response']['id'] if response['response'] response['status'] == 'success' end def self.find(id) command = { 'method' => 'Peoples.getOne', 'params' => { 'id' => id } } response = MultiJson.load(Sellsy::Api.request command) contact = Contact.new if response['response'] value = response['response'] contact.id = value['id'] end contact end def get_addresses command = { 'method' => 'Peoples.getAddresses', 'params' => { 'id' => id } } response = MultiJson.load(Sellsy::Api.request command) client = Contact.new if response['response'] value = response['response'] client.id = value['id'] end client end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sellsy-client-0.2.0 | lib/sellsy/contact.rb |
sellsy-client-0.1.0 | lib/sellsy/contact.rb |