Method: Bitly::API::User#initialize

Defined in:
lib/bitly/api/user.rb

#initialize(data:, client:, response: nil) ⇒ Bitly::API::User

Creates a Bitly::API::User object.

Examples:

user = Bitly::API::User.new(data: user_data, client: client)

Parameters:

  • data (Hash<String, String | Boolean>)

    The user data from the API

  • client (Bitly::API::Client)

    The authorized API client

  • response (Bitly::HTTP::Response) (defaults to: nil)

    The original HTTP response



58
59
60
61
62
63
64
65
# File 'lib/bitly/api/user.rb', line 58

def initialize(data:, client:, response: nil)
  assign_attributes(data)
  @client = client
  @response = response
  if data["emails"]
    @emails = data["emails"].map { |e| Email.new(e) }
  end
end