lib/nylas/contact.rb in nylas-4.0.0.rc3 vs lib/nylas/contact.rb in nylas-4.0.1
- old
+ new
@@ -17,22 +17,33 @@
attribute :given_name, :string
attribute :middle_name, :string
attribute :picture_url, :string
attribute :surname, :string
- attribute :birthday, :nylas_date
+ attribute :birthday, :string
attribute :suffix, :string
attribute :nickname, :string
attribute :company_name, :string
attribute :job_title, :string
attribute :manager_name, :string
attribute :office_location, :string
attribute :notes, :string
attribute :web_page, :web_page
- has_n_of_attribute :email_addresses, :email_address
+ has_n_of_attribute :groups, :contact_group
+ has_n_of_attribute :emails, :email_address
has_n_of_attribute :im_addresses, :im_address
has_n_of_attribute :physical_addresses, :physical_address
has_n_of_attribute :phone_numbers, :phone_number
has_n_of_attribute :web_pages, :web_page
+
+ # @returns [Tempfile] path to the retrieved picture. It is preferrable to cache this in your system than
+ # to retrieve it from nylas every time.
+ def picture
+ return @picture_tempfile if @picture_tempfile
+ @picture_tempfile = Tempfile.new
+ @picture_tempfile.write(api.get(path: "#{resource_path}/picture"))
+ @picture_tempfile.close
+ @picture_tempfile
+ end
end
end