liteapi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +51 -0
- data/LICENSE.txt +21 -0
- data/README.md +938 -0
- data/lib/liteapi/analytics.rb +49 -0
- data/lib/liteapi/booking.rb +73 -0
- data/lib/liteapi/client.rb +100 -0
- data/lib/liteapi/configuration.rb +25 -0
- data/lib/liteapi/connection.rb +136 -0
- data/lib/liteapi/errors.rb +24 -0
- data/lib/liteapi/guests.rb +64 -0
- data/lib/liteapi/rates.rb +77 -0
- data/lib/liteapi/static_data.rb +92 -0
- data/lib/liteapi/version.rb +5 -0
- data/lib/liteapi/vouchers.rb +100 -0
- data/lib/liteapi.rb +31 -0
- metadata +89 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Liteapi
|
|
4
|
+
module Vouchers
|
|
5
|
+
# List all vouchers
|
|
6
|
+
#
|
|
7
|
+
# Retrieves all available vouchers including codes, discounts, and validity.
|
|
8
|
+
#
|
|
9
|
+
# @return [Array] List of voucher objects
|
|
10
|
+
def vouchers
|
|
11
|
+
get('vouchers')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Get voucher details
|
|
15
|
+
#
|
|
16
|
+
# Retrieves details for a specific voucher.
|
|
17
|
+
#
|
|
18
|
+
# @param voucher_id [String, Integer] Voucher identifier
|
|
19
|
+
# @return [Hash] Voucher details
|
|
20
|
+
def voucher(voucher_id)
|
|
21
|
+
get("vouchers/#{voucher_id}")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Create a voucher
|
|
25
|
+
#
|
|
26
|
+
# Creates a new voucher with specified settings.
|
|
27
|
+
#
|
|
28
|
+
# @param voucher_code [String] Unique voucher code
|
|
29
|
+
# @param discount_type [String] Type of discount ('percentage' or 'fixed')
|
|
30
|
+
# @param discount_value [Float] Discount value
|
|
31
|
+
# @param minimum_spend [Float] Minimum spend to apply voucher
|
|
32
|
+
# @param maximum_discount_amount [Float] Maximum discount amount
|
|
33
|
+
# @param currency [String] Currency code
|
|
34
|
+
# @param validity_start [String] Start date (YYYY-MM-DD)
|
|
35
|
+
# @param validity_end [String] End date (YYYY-MM-DD)
|
|
36
|
+
# @param usages_limit [Integer] Maximum redemptions
|
|
37
|
+
# @param status [String] Voucher status ('active' or 'inactive')
|
|
38
|
+
# @return [Hash] Created voucher confirmation
|
|
39
|
+
def create_voucher(voucher_code:, discount_type:, discount_value:, minimum_spend:,
|
|
40
|
+
maximum_discount_amount:, currency:, validity_start:, validity_end:,
|
|
41
|
+
usages_limit:, status:)
|
|
42
|
+
post('vouchers', {
|
|
43
|
+
voucher_code: voucher_code,
|
|
44
|
+
discount_type: discount_type,
|
|
45
|
+
discount_value: discount_value,
|
|
46
|
+
minimum_spend: minimum_spend,
|
|
47
|
+
maximum_discount_amount: maximum_discount_amount,
|
|
48
|
+
currency: currency,
|
|
49
|
+
validity_start: validity_start,
|
|
50
|
+
validity_end: validity_end,
|
|
51
|
+
usages_limit: usages_limit,
|
|
52
|
+
status: status
|
|
53
|
+
})
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Update a voucher
|
|
57
|
+
#
|
|
58
|
+
# Updates an existing voucher's settings.
|
|
59
|
+
#
|
|
60
|
+
# @param voucher_id [String, Integer] Voucher identifier
|
|
61
|
+
# @param voucher_code [String] Unique voucher code
|
|
62
|
+
# @param discount_type [String] Type of discount
|
|
63
|
+
# @param discount_value [Float] Discount value
|
|
64
|
+
# @param minimum_spend [Float] Minimum spend
|
|
65
|
+
# @param maximum_discount_amount [Float] Maximum discount
|
|
66
|
+
# @param currency [String] Currency code
|
|
67
|
+
# @param validity_start [String] Start date (YYYY-MM-DD)
|
|
68
|
+
# @param validity_end [String] End date (YYYY-MM-DD)
|
|
69
|
+
# @param usages_limit [Integer] Maximum redemptions
|
|
70
|
+
# @param status [String] Voucher status
|
|
71
|
+
# @return [Hash] Update confirmation
|
|
72
|
+
def update_voucher(voucher_id, voucher_code:, discount_type:, discount_value:, minimum_spend:,
|
|
73
|
+
maximum_discount_amount:, currency:, validity_start:, validity_end:,
|
|
74
|
+
usages_limit:, status:)
|
|
75
|
+
put("vouchers/#{voucher_id}", {
|
|
76
|
+
voucher_code: voucher_code,
|
|
77
|
+
discount_type: discount_type,
|
|
78
|
+
discount_value: discount_value,
|
|
79
|
+
minimum_spend: minimum_spend,
|
|
80
|
+
maximum_discount_amount: maximum_discount_amount,
|
|
81
|
+
currency: currency,
|
|
82
|
+
validity_start: validity_start,
|
|
83
|
+
validity_end: validity_end,
|
|
84
|
+
usages_limit: usages_limit,
|
|
85
|
+
status: status
|
|
86
|
+
})
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Update voucher status
|
|
90
|
+
#
|
|
91
|
+
# Activates or deactivates a voucher.
|
|
92
|
+
#
|
|
93
|
+
# @param voucher_id [String, Integer] Voucher identifier
|
|
94
|
+
# @param status [String] New status ('active' or 'inactive')
|
|
95
|
+
# @return [Hash] Update confirmation
|
|
96
|
+
def update_voucher_status(voucher_id, status:)
|
|
97
|
+
put("vouchers/#{voucher_id}/status", { status: status })
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
data/lib/liteapi.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'liteapi/version'
|
|
4
|
+
require_relative 'liteapi/configuration'
|
|
5
|
+
require_relative 'liteapi/errors'
|
|
6
|
+
require_relative 'liteapi/connection'
|
|
7
|
+
require_relative 'liteapi/static_data'
|
|
8
|
+
require_relative 'liteapi/rates'
|
|
9
|
+
require_relative 'liteapi/booking'
|
|
10
|
+
require_relative 'liteapi/guests'
|
|
11
|
+
require_relative 'liteapi/vouchers'
|
|
12
|
+
require_relative 'liteapi/analytics'
|
|
13
|
+
require_relative 'liteapi/client'
|
|
14
|
+
|
|
15
|
+
module Liteapi
|
|
16
|
+
class << self
|
|
17
|
+
attr_writer :configuration
|
|
18
|
+
|
|
19
|
+
def configuration
|
|
20
|
+
@configuration ||= Configuration.new
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def configure
|
|
24
|
+
yield(configuration)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def reset_configuration!
|
|
28
|
+
@configuration = Configuration.new
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: liteapi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Alan Bradburne
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-01-12 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: faraday
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: faraday-retry
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2.0'
|
|
41
|
+
description: A Ruby-native SDK for the LiteAPI travel platform, providing access to
|
|
42
|
+
hotel search, booking, and static data endpoints.
|
|
43
|
+
email:
|
|
44
|
+
- abradburne@gmail.com
|
|
45
|
+
executables: []
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- CHANGELOG.md
|
|
50
|
+
- LICENSE.txt
|
|
51
|
+
- README.md
|
|
52
|
+
- lib/liteapi.rb
|
|
53
|
+
- lib/liteapi/analytics.rb
|
|
54
|
+
- lib/liteapi/booking.rb
|
|
55
|
+
- lib/liteapi/client.rb
|
|
56
|
+
- lib/liteapi/configuration.rb
|
|
57
|
+
- lib/liteapi/connection.rb
|
|
58
|
+
- lib/liteapi/errors.rb
|
|
59
|
+
- lib/liteapi/guests.rb
|
|
60
|
+
- lib/liteapi/rates.rb
|
|
61
|
+
- lib/liteapi/static_data.rb
|
|
62
|
+
- lib/liteapi/version.rb
|
|
63
|
+
- lib/liteapi/vouchers.rb
|
|
64
|
+
homepage: https://github.com/abradburne/liteapi-ruby-sdk
|
|
65
|
+
licenses:
|
|
66
|
+
- MIT
|
|
67
|
+
metadata:
|
|
68
|
+
homepage_uri: https://github.com/abradburne/liteapi-ruby-sdk
|
|
69
|
+
changelog_uri: https://github.com/abradburne/liteapi-ruby-sdk/blob/main/CHANGELOG.md
|
|
70
|
+
post_install_message:
|
|
71
|
+
rdoc_options: []
|
|
72
|
+
require_paths:
|
|
73
|
+
- lib
|
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
|
+
requirements:
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: 3.2.0
|
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
84
|
+
requirements: []
|
|
85
|
+
rubygems_version: 3.5.22
|
|
86
|
+
signing_key:
|
|
87
|
+
specification_version: 4
|
|
88
|
+
summary: Ruby SDK for LiteAPI travel services
|
|
89
|
+
test_files: []
|