Sha256: de2b52eb2f269f6c3f4df98377622540eea932b6f62cd315af5b3351c70b9231

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

require 'washbullet/entity'

module Washbullet
  class Contact < Entity
    def self.from_response(response)
      response.body['contacts'].each_with_object([]) {|attributes, memo|
        next unless attributes['active']

        memo << new(attributes)
      }
    end

    def name
      body['name']
    end

    def email
      body['email']
    end

    def image_url
      body['image_url']
    end

    private

    def receiver
      :email
    end

    def identifier
      body['email']
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
washbullet-0.4.0 lib/washbullet/contact.rb