Class: Leal::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/leal/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(token:, base_url: nil, max_retries: 2) ⇒ void

Parameters:

  • token (String)
  • base_url (String, nil) (defaults to: nil)
  • max_retries (Integer) (defaults to: 2)


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/leal/client.rb', line 10

def initialize(token:, base_url: nil, max_retries: 2)
  @raw_client = Leal::Internal::Http::RawClient.new(
    base_url: base_url || Leal::Environment::PRODUCTION,
    headers: {
      "User-Agent" => "leal/0.0.11",
      "X-Fern-Language" => "Ruby",
      Authorization: "Bearer #{token}"
    },
    max_retries: max_retries
  )
end

Instance Method Details

#cardsLeal::Cards::Client

Returns:



28
29
30
# File 'lib/leal/client.rb', line 28

def cards
  @cards ||= Leal::Cards::Client.new(client: @raw_client)
end

#customer_cardsLeal::CustomerCards::Client



38
39
40
# File 'lib/leal/client.rb', line 38

def customer_cards
  @customer_cards ||= Leal::CustomerCards::Client.new(client: @raw_client)
end

#customersLeal::Customers::Client



33
34
35
# File 'lib/leal/client.rb', line 33

def customers
  @customers ||= Leal::Customers::Client.new(client: @raw_client)
end

#locationsLeal::Locations::Client



43
44
45
# File 'lib/leal/client.rb', line 43

def locations
  @locations ||= Leal::Locations::Client.new(client: @raw_client)
end

#postersLeal::Posters::Client



48
49
50
# File 'lib/leal/client.rb', line 48

def posters
  @posters ||= Leal::Posters::Client.new(client: @raw_client)
end

#rewardsLeal::Rewards::Client



53
54
55
# File 'lib/leal/client.rb', line 53

def rewards
  @rewards ||= Leal::Rewards::Client.new(client: @raw_client)
end

#statusLeal::Status::Client



58
59
60
# File 'lib/leal/client.rb', line 58

def status
  @status ||= Leal::Status::Client.new(client: @raw_client)
end

#storesLeal::Stores::Client



23
24
25
# File 'lib/leal/client.rb', line 23

def stores
  @stores ||= Leal::Stores::Client.new(client: @raw_client)
end