fantasticstay_api 0.1.10 → 0.1.12
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 +4 -4
- data/.gitignore +2 -0
- data/.irbrc +7 -0
- data/Gemfile.lock +2 -2
- data/docker-compose.yml +1 -2
- data/lib/fantasticstay_api/api.rb +6 -3
- data/lib/fantasticstay_api/client.rb +46 -2
- data/lib/fantasticstay_api/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61c7c8e9ac360e9a4b64ec4813ff0b3da4f9ed73b6c8b89298208ae937a65f66
|
4
|
+
data.tar.gz: 527e2dde65e7533e466dfb94016fedea3ce17cd815471f7fd6cf945a3c06f7bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27d89ebc3deb1b633cd32a3024d01641552e46fb2d7000d6c7212b5431b4e80cba979c7069d1a1f5462a9697b1c62221b7c1de66e174704bdaab91a1ff36651a
|
7
|
+
data.tar.gz: 33cabc72170bdb2fae13a0e76939f6e9f1ad33b2a8d9bb0040565b31d1c8abdf067c6b15da87ca505ba70f6c4e54a8f19024271405442a76306f83c8ab7b3e6a
|
data/.gitignore
CHANGED
data/.irbrc
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fantasticstay_api (0.1.
|
4
|
+
fantasticstay_api (0.1.10)
|
5
5
|
api_cache (~> 0.3.0)
|
6
6
|
dry-configurable (~> 0.13)
|
7
7
|
faraday (~> 2.6.0)
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
ast (2.4.2)
|
17
17
|
base64 (0.2.0)
|
18
18
|
bigdecimal (3.1.9)
|
19
|
-
concurrent-ruby (1.3.
|
19
|
+
concurrent-ruby (1.3.5)
|
20
20
|
crack (1.0.0)
|
21
21
|
bigdecimal
|
22
22
|
rexml
|
data/docker-compose.yml
CHANGED
@@ -95,14 +95,17 @@ module FantasticstayApi
|
|
95
95
|
client.headers['User-Agent'] = config.user_agent
|
96
96
|
end
|
97
97
|
|
98
|
-
def request(http_method:, endpoint:, params: {}, cache_ttl: 3600)
|
98
|
+
def request(http_method:, endpoint:, params: {}, body: {}, cache_ttl: 3600)
|
99
99
|
response = APICache.get(
|
100
|
-
Digest::SHA256.bubblebabble(config.token) + http_method.to_s + endpoint + params.to_s,
|
100
|
+
Digest::SHA256.bubblebabble(config.token) + http_method.to_s + endpoint + params.to_s + body.to_s,
|
101
101
|
cache: cache_ttl,
|
102
102
|
valid: config.stale_validity,
|
103
103
|
timeout: config.timeout
|
104
104
|
) do
|
105
|
-
client.public_send(http_method, endpoint
|
105
|
+
client.public_send(http_method, endpoint) do |req|
|
106
|
+
req.params = params
|
107
|
+
req.body = body.to_json if body.size
|
108
|
+
end
|
106
109
|
end
|
107
110
|
|
108
111
|
process_http_response(response)
|
@@ -42,14 +42,14 @@ module FantasticstayApi
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# FantasticstayApi::Client.new.reservations(38859)
|
45
|
-
def reservations(listing_id, filters = [], sort = { order: 'checkIn', direction: 'desc' }, global_params = {})
|
45
|
+
def reservations(listing_id, filters = [], sort = { order: 'checkIn', direction: 'desc' }, global_params = {}, cache_ttl = 3600 * 24)
|
46
46
|
response = request(
|
47
47
|
http_method: :get,
|
48
48
|
endpoint: 'reservations',
|
49
49
|
params: {
|
50
50
|
listing_id: listing_id, filters: filters.to_json, sort: sort[:order], direction: sort[:direction]
|
51
51
|
}.merge!(global_params),
|
52
|
-
cache_ttl:
|
52
|
+
cache_ttl: cache_ttl
|
53
53
|
)
|
54
54
|
process_response(response)
|
55
55
|
end
|
@@ -63,6 +63,50 @@ module FantasticstayApi
|
|
63
63
|
process_response(response)
|
64
64
|
end
|
65
65
|
|
66
|
+
def custom_fields(global_params = {})
|
67
|
+
response = request(
|
68
|
+
http_method: :get,
|
69
|
+
endpoint: "custom_fields",
|
70
|
+
params: global_params
|
71
|
+
)
|
72
|
+
process_response(response)
|
73
|
+
end
|
74
|
+
|
75
|
+
def reservation_set_custom_field_value(reservation_id, custom_field_id, value, global_params: {})
|
76
|
+
response = request(
|
77
|
+
http_method: :post,
|
78
|
+
endpoint: "reservations/custom_field_update",
|
79
|
+
params: global_params,
|
80
|
+
body: {
|
81
|
+
reservation_id: reservation_id,
|
82
|
+
custom_field_id: custom_field_id,
|
83
|
+
value: value,
|
84
|
+
}
|
85
|
+
)
|
86
|
+
process_response(response)
|
87
|
+
end
|
88
|
+
|
89
|
+
def set_custom_field_value(id, value, listing_ids: [], reservation_ids: [], global_params: {})
|
90
|
+
response = request(
|
91
|
+
http_method: :post,
|
92
|
+
endpoint: "custom_fields/set_values",
|
93
|
+
params: {
|
94
|
+
custom_field_id: id,
|
95
|
+
# value: value,
|
96
|
+
# listing_ids: listing_ids.to_json,
|
97
|
+
# reservation_ids: reservation_ids.to_json
|
98
|
+
}.merge!(global_params),
|
99
|
+
body: {
|
100
|
+
value: value,
|
101
|
+
listing_ids: listing_ids,
|
102
|
+
reservation_ids: reservation_ids
|
103
|
+
# listing_ids: "{\"listing_ids\":[#{listing_ids.join(',')}]}",
|
104
|
+
# reservation_ids: "{\"reservation_ids\":[#{reservation_ids.join(',')}]}"
|
105
|
+
},
|
106
|
+
)
|
107
|
+
process_response(response)
|
108
|
+
end
|
109
|
+
|
66
110
|
def guest(guest_id, global_params = {})
|
67
111
|
response = request(
|
68
112
|
http_method: :get,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fantasticstay_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dinis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api_cache
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".github/workflows/main.yml"
|
77
77
|
- ".gitignore"
|
78
|
+
- ".irbrc"
|
78
79
|
- ".rspec"
|
79
80
|
- ".rubocop.yml"
|
80
81
|
- CHANGELOG.md
|
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
120
|
- !ruby/object:Gem::Version
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.5.22
|
123
124
|
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: FantasticStay API Wrapper.
|