Sha256: 457b0bdfd1fb48cf820345919aa09576c200b1493cfa2827cbb3862d7ed2b6f1

Contents?: true

Size: 1.05 KB

Versions: 24

Compression:

Stored size: 1.05 KB

Contents

require 'intercom/user_resource'

module Intercom

  ##
  # Represents a note on a user
  #
  # A note contains a note (the text of the note you want to leave)
  #
  # == Examples
  #
  #  note = Intercom::Note.create(:email => "person@example.com", :body => "This is the note you want to make on the user account")

  # You can also create a note and save it like this:
  #  note = Intercom::Note.new
  #  note.body = "This is the note you want to make on the user account"
  #  note.save

  class Note < UserResource
    ##
    # Creates a new Note using params and saves it
    # @see #save
    def self.create(params)
      requires_parameters(params, %W(body))
      Note.new(params).save
    end

    ##
    # Records a note on a user of your application
    def save
      response = Intercom.post("/v1/users/notes", to_hash)
      self.update_from_api_response(response)
    end

    ##
    # Set the text of the note for the user
    def body=(body)
      @attributes["body"] = body
    end

    def user
      User.from_api(@attributes['user'])
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
intercom-1.0.0 lib/intercom/note.rb
intercom-0.3.0 lib/intercom/note.rb
intercom-0.2.3 lib/intercom/note.rb
intercom-0.2.2 lib/intercom/note.rb
intercom-0.2.1 lib/intercom/note.rb
intercom-0.2.0 lib/intercom/note.rb
intercom-0.1.19 lib/intercom/note.rb
intercom-0.1.17 lib/intercom/note.rb
intercom-0.1.16 lib/intercom/note.rb
intercom-0.1.15 lib/intercom/note.rb
intercom-0.1.14 lib/intercom/note.rb
intercom-0.1.13 lib/intercom/note.rb
intercom-0.1.12 lib/intercom/note.rb
intercom-0.1.11 lib/intercom/note.rb
intercom-0.1.10 lib/intercom/note.rb
intercom-0.1.9 lib/intercom/note.rb
intercom-0.1.8 lib/intercom/note.rb
intercom-0.1.7 lib/intercom/note.rb
intercom-0.1.6 lib/intercom/note.rb
intercom-0.1.5 lib/intercom/note.rb