fantasticstay_api 0.1.10 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf9be90bc43b625d86fc4f6a024a4031af806d435b7328499a88e24001d10b4d
4
- data.tar.gz: '09745920add5e1e3c4ca23997b1ca75bf8a8e82ccd7b7bda24cf4ca7cacfa33c'
3
+ metadata.gz: dc5c5fa20b06a9c957ecc4fff66c82404c60e7f08826e9d99218d0a491064ad9
4
+ data.tar.gz: d72c3cdba569e622a600681e18b35263d0bfaebba294187b5ebb2d255d8f5aad
5
5
  SHA512:
6
- metadata.gz: 98c7479b0c84b51e96dce10274f338ba069c7952bfc977f26af804a51a8b5bb36e58192ccbcc4acdb2ca8fbaaacd8009178c801837eda640fbcde8c95112e780
7
- data.tar.gz: 64dcd5e2faf0138e51a6544ae20c04519c143c3ee010dbf11548611c72b51ef7ddc10cc1bd60d2fe391ccb9593162eb6cb9d7d0d6545e1d869d8069075b3316a
6
+ metadata.gz: e4e3c76f33cc3691855e87ae24fd758268802b6819b3e38f74a4841dbaac79ca26fe407c46a9c1b207ad6f2052bba7762bcf0cf36388bc975ca3089629355a6c
7
+ data.tar.gz: 91911d1412ceb3a9ab46c853936edbe8e0d70cabc74f84e7cbbfe5ae40b2c18c2c2d4ca01098f23bbf08377dd05786f8f8ae286447ea90a0e254b39341d339cf
data/.gitignore CHANGED
@@ -16,3 +16,5 @@ fantasticstay_api.iml
16
16
 
17
17
  # custom ignores
18
18
  .env
19
+ *.gem
20
+ /.irb_history
data/.irbrc ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'irb'
4
+ require 'irb/completion'
5
+ require 'rubygems'
6
+ require 'pp'
7
+ IRB.conf[:SAVE_HISTORY] = 500
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fantasticstay_api (0.1.9)
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.4)
19
+ concurrent-ruby (1.3.5)
20
20
  crack (1.0.0)
21
21
  bigdecimal
22
22
  rexml
data/docker-compose.yml CHANGED
@@ -1,7 +1,6 @@
1
- version: "3.9"
2
1
  services:
3
2
  app:
4
3
  build: .
5
4
  command: bash -c "rake"
6
5
  volumes:
7
- - .:/usr/src/app
6
+ - .:/usr/src/app
@@ -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, params)
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)
@@ -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,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FantasticstayApi
4
- VERSION = '0.1.10'.freeze
4
+ VERSION = '0.1.11'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fantasticstay_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dinis
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-14 00:00:00.000000000 Z
10
+ date: 2025-08-10 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: api_cache
@@ -75,6 +74,7 @@ extra_rdoc_files: []
75
74
  files:
76
75
  - ".github/workflows/main.yml"
77
76
  - ".gitignore"
77
+ - ".irbrc"
78
78
  - ".rspec"
79
79
  - ".rubocop.yml"
80
80
  - CHANGELOG.md
@@ -104,7 +104,6 @@ metadata:
104
104
  homepage_uri: https://github.com/dlage/fantasticstay_api_gem
105
105
  source_code_uri: https://github.com/dlage/fantasticstay_api_gem
106
106
  changelog_uri: https://github.com/dlage/fantasticstay_api_gem/blob/master/CHANGELOG.md
107
- post_install_message:
108
107
  rdoc_options: []
109
108
  require_paths:
110
109
  - lib
@@ -119,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
118
  - !ruby/object:Gem::Version
120
119
  version: '0'
121
120
  requirements: []
122
- rubygems_version: 3.3.26
123
- signing_key:
121
+ rubygems_version: 3.6.2
124
122
  specification_version: 4
125
123
  summary: FantasticStay API Wrapper.
126
124
  test_files: []