Class: Lmb::Developers::Loyalty

Inherits:
Object
  • Object
show all
Defined in:
lib/lmb/developers/loyalty.rb

Constant Summary collapse

VOUCHER_EXPIRED_PATH =

Define constant paths for different API endpoints.

'/v1/loyalty/voucher/expired'.freeze
VOUCHER_PROVISIONED_PATH =
'/v1/loyalty/voucher/provisioned'.freeze
VOUCHER_ACTIVATED_PATH =
'/v1/loyalty/voucher/activated'.freeze
SCORING_REDEMPTION_PATH =
'/v1/loyalty/redemption'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



6
7
8
# File 'lib/lmb/developers/loyalty.rb', line 6

def configuration
  @configuration
end

Class Method Details

.redemption(redemptions) ⇒ Boolean

Handles the redemption process.

Parameters:

  • redemptions (Hash)

    the redemptions object.

Returns:

  • (Boolean)

    returns true if response code is 202, false otherwise.



42
43
44
# File 'lib/lmb/developers/loyalty.rb', line 42

def self.redemption(redemptions)
  post_request(SCORING_REDEMPTION_PATH, redemptions)
end

.voucher_activated(activations) ⇒ Boolean

Set activated vouchers for inhabitants.

Parameters:

  • activations (Hash)

    the activations object.

Returns:

  • (Boolean)

    returns true if response code is 202, false otherwise.



34
35
36
# File 'lib/lmb/developers/loyalty.rb', line 34

def self.voucher_activated(activations)
  post_request(VOUCHER_ACTIVATED_PATH, 'activations' => activations)
end

.voucher_expired(expirations) ⇒ Boolean

Set expired vouchers for inhabitants.

Parameters:

  • expirations (Hash)

    the expirations object.

Returns:

  • (Boolean)

    returns true if response code is 202, false otherwise.



18
19
20
# File 'lib/lmb/developers/loyalty.rb', line 18

def self.voucher_expired(expirations)
  post_request(VOUCHER_EXPIRED_PATH, 'expirations' => expirations)
end

.voucher_provisioned(provisions) ⇒ Boolean

Set provisioned vouchers for inhabitants.

Parameters:

  • provisions (Hash)

    the provisions object.

Returns:

  • (Boolean)

    returns true if response code is 202, false otherwise.



26
27
28
# File 'lib/lmb/developers/loyalty.rb', line 26

def self.voucher_provisioned(provisions)
  post_request(VOUCHER_PROVISIONED_PATH, 'provisions' => provisions)
end