Class: GrowsurfRuby::Resources::Campaign::Reward

Inherits:
Object
  • Object
show all
Defined in:
lib/growsurf_ruby/resources/campaign/reward.rb

Overview

Participant reward retrieval and manual reward operations.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Reward

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Reward.

Parameters:



96
97
98
# File 'lib/growsurf_ruby/resources/campaign/reward.rb', line 96

def initialize(client:)
  @client = client
end

Instance Method Details

#approve(reward_id, id:, fulfill: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::RewardApproveResponse

Approves a manually approved reward earned by a participant.

Parameters:

  • reward_id (String)

    Path param: Participant reward ID.

  • id (String)

    Path param: GrowSurf program ID.

  • fulfill (Boolean)

    Body param: Set true to mark the reward as fulfilled after approval.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/growsurf_ruby/resources/campaign/reward.rb', line 51

def approve(reward_id, params)
  parsed, options = GrowsurfRuby::Campaign::RewardApproveParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/reward/%2$s/approve", id, reward_id],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::RewardApproveResponse,
    options: options
  )
end

#delete(reward_id, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::RewardDeleteResponse

Removes a manually approved participant reward that has not already been approved.

Parameters:

  • reward_id (String)

    Participant reward ID.

  • id (String)

    GrowSurf program ID.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/growsurf_ruby/resources/campaign/reward.rb', line 22

def delete(reward_id, params)
  parsed, options = GrowsurfRuby::Campaign::RewardDeleteParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["campaign/%1$s/reward/%2$s", id, reward_id],
    model: GrowsurfRuby::Models::Campaign::RewardDeleteResponse,
    options: options
  )
end

#fulfill(reward_id, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::RewardFulfillResponse

Marks an approved participant reward as fulfilled.

Parameters:

  • reward_id (String)

    Participant reward ID.

  • id (String)

    GrowSurf program ID.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/growsurf_ruby/resources/campaign/reward.rb', line 79

def fulfill(reward_id, params)
  parsed, options = GrowsurfRuby::Campaign::RewardFulfillParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/reward/%2$s/fulfill", id, reward_id],
    model: GrowsurfRuby::Models::Campaign::RewardFulfillResponse,
    options: options
  )
end