Class: Finicity::V1::Request::GetCustomersByUsername

Inherits:
Object
  • Object
show all
Extended by:
HTTPClient::IncludeClient
Includes:
Logger
Defined in:
lib/finicity/v1/request/get_customers_by_username.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#log_request, #mask_body

Constructor Details

#initialize(token, username, start, limit) ⇒ GetCustomersByUsername

Instance Methods



21
22
23
24
25
26
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 21

def initialize(token, username, start, limit)
  @limit = limit
  @start = start
  @token = token
  @username = username
end

Instance Attribute Details

#limitObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 13

def limit
  @limit
end

#startObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 13

def start
  @start
end

#tokenObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 13

def token
  @token
end

#usernameObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 13

def username
  @username
end

Instance Method Details

#get_customers_by_usernameObject



28
29
30
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 28

def get_customers_by_username
  http_client.get(url, query, headers)
end

#headersObject



32
33
34
35
36
37
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 32

def headers
  {
    'Finicity-App-Key' => ::Finicity.config.app_key,
    'Finicity-App-Token' => token
  }
end

#queryObject



39
40
41
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 39

def query
  { :search => username, :start => start, :limit => limit }
end

#urlObject



43
44
45
46
47
48
49
# File 'lib/finicity/v1/request/get_customers_by_username.rb', line 43

def url
  ::URI.join(
    ::Finicity.config.base_url,
    'v1/',
    'customers'
  )
end