Sha256: 1fc5b0dd564b021263956c58888e72407bb3184b96261672c3999176aa56b8d9

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

require 'outreach-ruby/model'

module Outreach
  class User
    extend Outreach::Model

    attr_accessor :id, :first_name, :last_name, :email, :response

    def initialize(attrs)
      @id = attrs['id']
      @first_name = attrs['first_name']
      @last_name = attrs['last_name']
      @email = attrs['email']
      @response = attrs['response']
    end

    def self.build_from_attributes_hash(data)
      result = {}
      result['id'] = data['id']
      result['first_name'] = nested_hash_value(
        data,
        %w[attributes firstName]
      )
      result['last_name'] = nested_hash_value(
        data,
        %w[attributes lastName]
      )
      result['email'] = nested_hash_value(
        data,
        %w[attributes email]
      )
      result['response'] = data
      new(result)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outreach-ruby-0.0.2 lib/outreach-ruby/user.rb