Class: Line::Bot::V2::Shop::ApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/line/bot/v2/shop/api/shop_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ ApiClient

Initializes a new Line::Bot::V2::Shop::ApiClient instance.

Examples:

@client ||= Line::Bot::V2::Shop::ApiClient.new(
  channel_access_token: "YOUR_CHANNEL_ACCESS_TOKEN",
  http_options: {
    open_timeout: 5,
    read_timeout: 5,
  }
)

Parameters:

  • base_url (String) (defaults to: nil)

    The base URL for requests (optional). Defaults to ‘api.line.me’ if none is provided. You can override this for testing or to use a mock server.

  • channel_access_token (String)

    The channel access token for authorization.

  • http_options (Hash) (defaults to: {})

    HTTP options (same as Net::HTTP options). See: docs.ruby-lang.org/en/3.4/Net/HTTP.html to understand the options.



38
39
40
41
42
43
44
45
46
# File 'lib/line/bot/v2/shop/api/shop_client.rb', line 38

def initialize(base_url: nil, channel_access_token:, http_options: {})
  @http_client = HttpClient.new(
    base_url: base_url || 'https://api.line.me',
    http_headers: {
      Authorization: "Bearer #{channel_access_token}"
    },
    http_options: http_options
  )
end

Instance Method Details

#mission_sticker_v3(mission_sticker_request:) ⇒ String?

Sends a mission sticker. This requests to POST https://api.line.me/shop/v3/mission When you want to get HTTP status code or response headers, use #mission_sticker_v3_with_http_info instead of this.

Parameters:

Returns:

  • (String, nil)

    when HTTP status code is 200

  • (String, nil)

    when other HTTP status code is returned. This String is HTTP response body itself.

See Also:



82
83
84
85
86
87
88
89
90
# File 'lib/line/bot/v2/shop/api/shop_client.rb', line 82

def mission_sticker_v3(
  mission_sticker_request:
)
  response_body, _status_code, _headers = mission_sticker_v3_with_http_info(
    mission_sticker_request: mission_sticker_request
  )

  response_body
end

#mission_sticker_v3_with_http_info(mission_sticker_request:) ⇒ Array((String|nil), Integer, Hash{String => String})

Sends a mission sticker. This requests to POST https://api.line.me/shop/v3/mission This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.

Parameters:

Returns:

  • (Array((String|nil), Integer, Hash{String => String}))

    when HTTP status code is 200

  • (Array((String|nil), Integer, Hash{String => String}))

    when other HTTP status code is returned. String is HTTP response body itself.

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/line/bot/v2/shop/api/shop_client.rb', line 56

def mission_sticker_v3_with_http_info( # steep:ignore MethodBodyTypeMismatch 
  mission_sticker_request:
)
  path = "/shop/v3/mission"

  response = @http_client.post(
    path: path,
    body_params: mission_sticker_request,
  )

  case response.code.to_i
  when 200
    [response.body, 200, response.each_header.to_h]
  else
    [response.body, response.code.to_i, response.each_header.to_h]
  end
end