rakuten_travel_api 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f05fc460832aeeccea114e4eacfb29ff1ca8fe132f9e0833a2b20d7be26af5a6
4
+ data.tar.gz: 2b9c8ef32bd422a13314535dda379d38e008fcd2c269dc04a8b34539554d72f8
5
+ SHA512:
6
+ metadata.gz: d77e13ceed53067b3940e8441e8a0fd7a14ddc15758ae4b2694487839216bafc1ebabfb7d00e078075db60f3d34d59dc5ebc98d7368682045319ff5ab784c8ab
7
+ data.tar.gz: ffac71adb887f4322d964a1eca27da4c5479b5ee61820e7af0f6382535222e41c8d5c57228a32074e7b3e4c2da3d26ea33af84822b09308fbf99a4bb255a2af4
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,36 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ Style/Documentation:
7
+ # Skips checking to make sure top level modules / classes have a comment.
8
+ Enabled: false
9
+
10
+ Layout/LineLength:
11
+ Max: 100
12
+
13
+ Metrics/MethodLength:
14
+ Max: 15
15
+
16
+ Metrics/BlockLength:
17
+ Exclude:
18
+ - "spec/**/*"
19
+
20
+ Style/StringLiterals:
21
+ EnforcedStyle: double_quotes
22
+
23
+ Style/FrozenStringLiteralComment:
24
+ Enabled: false
25
+
26
+ Style/RedundantParentheses:
27
+ Enabled: false
28
+
29
+ Lint/EmptyClass:
30
+ Enabled: false
31
+
32
+ Lint/MissingSuper:
33
+ Enabled: false
34
+
35
+ Lint/StructNewOverride:
36
+ Enabled: false
data/CHANGELOG.md ADDED
File without changes
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at 824rikukomiya@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rakuten_travel_api.gemspec
6
+ gemspec
7
+
8
+ gem "byebug"
9
+ gem "rake", "~> 13.0"
10
+ gem "rspec", "~> 3.0"
11
+ gem "rubocop", "~> 1.44.1"
12
+ gem "vcr", "~> 6.1.0"
13
+ gem "webmock", "~> 3.18.1"
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rakuten_travel_api (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.8.1)
10
+ public_suffix (>= 2.0.2, < 6.0)
11
+ ast (2.4.2)
12
+ byebug (11.1.3)
13
+ crack (0.4.5)
14
+ rexml
15
+ diff-lcs (1.5.0)
16
+ hashdiff (1.0.1)
17
+ json (2.6.3)
18
+ parallel (1.22.1)
19
+ parser (3.2.0.0)
20
+ ast (~> 2.4.1)
21
+ public_suffix (5.0.1)
22
+ rainbow (3.1.1)
23
+ rake (13.0.6)
24
+ regexp_parser (2.6.2)
25
+ rexml (3.2.5)
26
+ rspec (3.12.0)
27
+ rspec-core (~> 3.12.0)
28
+ rspec-expectations (~> 3.12.0)
29
+ rspec-mocks (~> 3.12.0)
30
+ rspec-core (3.12.1)
31
+ rspec-support (~> 3.12.0)
32
+ rspec-expectations (3.12.2)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.12.0)
35
+ rspec-mocks (3.12.3)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.12.0)
38
+ rspec-support (3.12.0)
39
+ rubocop (1.44.1)
40
+ json (~> 2.3)
41
+ parallel (~> 1.10)
42
+ parser (>= 3.2.0.0)
43
+ rainbow (>= 2.2.2, < 4.0)
44
+ regexp_parser (>= 1.8, < 3.0)
45
+ rexml (>= 3.2.5, < 4.0)
46
+ rubocop-ast (>= 1.24.1, < 2.0)
47
+ ruby-progressbar (~> 1.7)
48
+ unicode-display_width (>= 2.4.0, < 3.0)
49
+ rubocop-ast (1.24.1)
50
+ parser (>= 3.1.1.0)
51
+ ruby-progressbar (1.11.0)
52
+ unicode-display_width (2.4.2)
53
+ vcr (6.1.0)
54
+ webmock (3.18.1)
55
+ addressable (>= 2.8.0)
56
+ crack (>= 0.3.2)
57
+ hashdiff (>= 0.4.0, < 2.0.0)
58
+
59
+ PLATFORMS
60
+ x86_64-darwin-21
61
+
62
+ DEPENDENCIES
63
+ byebug
64
+ rake (~> 13.0)
65
+ rakuten_travel_api!
66
+ rspec (~> 3.0)
67
+ rubocop (~> 1.44.1)
68
+ vcr (~> 6.1.0)
69
+ webmock (~> 3.18.1)
70
+
71
+ BUNDLED WITH
72
+ 2.3.7
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 RikuKomiya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # RakutenTravelApi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rakuten_travel_api`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rakuten_travel_api'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rakuten_travel_api
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ RakutenTravelApi.configure do |c|
27
+ c.application_id = application_id
28
+ c.affiliate_id = affiliate_id #option
29
+ end
30
+
31
+ client = RakutenTravelApi::Client.new
32
+
33
+ client.keyword_hotel_search(keyword: "新宿")
34
+
35
+ hotels = client.hotels
36
+
37
+ hotels.first.hotel_name # => 新宿由縁
38
+ ```
39
+
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+
45
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rakuten_travel_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rakuten_travel_api/blob/main/CODE_OF_CONDUCT.md).
50
+
51
+ ## License
52
+
53
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
54
+
55
+ ## Code of Conduct
56
+
57
+ Everyone interacting in the RakutenTravelApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rakuten_travel_api/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+
5
+ module RakutenTravelApi
6
+ class Client
7
+ def initialize(application_id: nil, affiliate_id: nil)
8
+ RakutenTravelApi.application_id = application_id if application_id
9
+ RakutenTravelApi.affiliate_id = affiliate_id if affiliate_id
10
+ end
11
+
12
+ def keyword_hotel_search(keyword:, options: {})
13
+ path = "/services/api/Travel/KeywordHotelSearch/20170426"
14
+ params = RakutenTravelApi::Parameter.new(options.merge(keyword: keyword))
15
+ .to_params_for_keyword_search
16
+ req = RakutenTravelApi::Request.new(
17
+ path: path,
18
+ params: params
19
+ )
20
+
21
+ req.send_request
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ module RakutenTravelApi
2
+ module Configuration
3
+ attr_writer :application_id
4
+ attr_accessor :affiliate_id
5
+
6
+ def configure
7
+ yield self
8
+ end
9
+
10
+ def application_id
11
+ return @application_id if @application_id
12
+
13
+ raise RakutenTravelApi::Errors::ApplicationIdMissingError, "application id missing"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RakutenTravelApi
4
+ class Errors
5
+ class ApplicationIdMissingError < StandardError; end
6
+
7
+ class UnsupportedParamsError < StandardError; end
8
+
9
+ class ResponseError < StandardError
10
+ attr_accessor :code, :message
11
+
12
+ def initialize(code, message)
13
+ @code = Integer(code)
14
+ @message = message
15
+ end
16
+ end
17
+
18
+ class WrongParameterError < ResponseError; end
19
+
20
+ class NotFoundError < ResponseError; end
21
+
22
+ class TooManyRequestError < ResponseError; end
23
+
24
+ class SystemError < ResponseError; end
25
+
26
+ class ServiceUnavailableError < ResponseError; end
27
+
28
+ class NotDefinedError < ResponseError; end
29
+
30
+ def self.raise_response_error(code, res_body)
31
+ klass = case code
32
+ when 400
33
+ WrongParameterError
34
+ when 404
35
+ NotFoundError
36
+ when 429
37
+ TooManyRequestError
38
+ when 500
39
+ SystemError
40
+ when 503
41
+ ServiceUnavailableError
42
+ else
43
+ NotDefinedError
44
+ end
45
+
46
+ raise klass.new(code, res_body)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "string_helper"
4
+
5
+ module RakutenTravelApi
6
+ class Hotel
7
+ attr_reader :hotel_basic_info, :hotel_rating_info, :hotel_detail_info, :hotel_facilities_info,
8
+ :hotel_policy_info, :hotel_other_info
9
+
10
+ using RakutenTravelApi::StringHelper
11
+
12
+ HOTEL_INFO_NAMES = %w[hotel_basic_info hotel_rating_info hotel_detail_info
13
+ hotel_facilities_info hotel_policy_info hotel_other_info].freeze
14
+
15
+ def initialize(json_hotel)
16
+ @json_hotel = json_hotel
17
+ HOTEL_INFO_NAMES.each do |name|
18
+ struct = "RakutenTravelApi::Structs::#{name.capitalize_from_snake}".to_const
19
+ v = struct.new(tranform_json(name.to_camel))
20
+ instance_variable_set("@#{name.to_snake}", v)
21
+ end
22
+ end
23
+
24
+ def method_missing(method)
25
+ if (info_obj = HOTEL_INFO_NAMES.find { |name| send(name).respond_to?(method) })
26
+ send(info_obj).send(method)
27
+ else
28
+ super
29
+ end
30
+ end
31
+
32
+ def respond_to_missing?(sym, include_private); end
33
+
34
+ private
35
+
36
+ attr_reader :json_hotel
37
+
38
+ def tranform_json(param_name)
39
+ json_hotel.find do |json|
40
+ json[param_name]
41
+ end[param_name].to_h.transform_keys(&:to_snake)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,61 @@
1
+ require_relative "string_helper"
2
+
3
+ module RakutenTravelApi
4
+ class Parameter
5
+ using RakutenTravelApi::StringHelper
6
+
7
+ def initialize(options)
8
+ @application_id = RakutenTravelApi.application_id
9
+ @affiliate_id = RakutenTravelApi.affiliate_id
10
+ @options = options.transform_keys { |key| key.to_s.to_camel.to_sym }
11
+ end
12
+
13
+ def to_params_for_keyword_search
14
+ default_params = default_common_params.merge(default_keyword_search_params)
15
+
16
+ to_params(default_params)
17
+ end
18
+
19
+ private
20
+
21
+ attr_reader :application_id, :affiliate_id, :options
22
+
23
+ def to_params(default_params)
24
+ unsupported_params = options.keys.difference(default_params.keys)
25
+
26
+ unless unsupported_params.empty?
27
+ raise RakutenTravelApi::Errors::UnsupportedParamsError,
28
+ "#{unsupported_params} are unsupported"
29
+ end
30
+
31
+ default_params.merge(options).compact
32
+ end
33
+
34
+ def default_common_params
35
+ {
36
+ applicationId: application_id,
37
+ affiliateId: affiliate_id,
38
+ format: nil,
39
+ callback: nil,
40
+ elements: nil,
41
+ formatVersion: 1
42
+ }
43
+ end
44
+
45
+ def default_keyword_search_params
46
+ {
47
+ carrier: nil,
48
+ page: nil,
49
+ hits: nil,
50
+ datumType: nil,
51
+ keyword: nil,
52
+ middleClassCode: nil,
53
+ searchField: nil,
54
+ hotelChainCode: nil,
55
+ hotelThumbnailSize: nil,
56
+ responseType: "large",
57
+ sort: nil
58
+ }
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "uri"
5
+ require "json"
6
+
7
+ module RakutenTravelApi
8
+ class Request
9
+ attr_reader :params, :url, :path
10
+
11
+ def initialize(path:, params:)
12
+ @url = URI.parse("https://app.rakuten.co.jp/")
13
+ @path = path
14
+ @params = params
15
+ end
16
+
17
+ def send_request
18
+ res = create_request
19
+ code = res.code.to_i
20
+
21
+ RakutenTravelApi::Errors.raise_response_error(code, res.body) unless code == 200
22
+
23
+ RakutenTravelApi::Response.new(JSON.parse(res.body))
24
+ end
25
+
26
+ private
27
+
28
+ def create_request
29
+ http = Net::HTTP.new(url.host, url.port)
30
+ http.use_ssl = true
31
+
32
+ http.get "#{path}?#{URI.encode_www_form(params)}"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "string_helper"
4
+
5
+ module RakutenTravelApi
6
+ class Response
7
+ attr_reader :paging_info, :hotels
8
+
9
+ using RakutenTravelApi::StringHelper
10
+
11
+ PagingInfoStruct = Struct.new(
12
+ :record_count,
13
+ :page_count,
14
+ :page,
15
+ :first,
16
+ :last,
17
+ keyword_init: true
18
+ )
19
+
20
+ def initialize(json_response)
21
+ @paging_info = PagingInfoStruct.new(
22
+ json_response["pagingInfo"].to_h.transform_keys(&:to_snake)
23
+ )
24
+ @hotels = json_response["hotels"].map do |json_hotel|
25
+ Hotel.new(json_hotel["hotel"])
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RakutenTravelApi
4
+ module StringHelper
5
+ refine String do
6
+ def to_snake
7
+ gsub(/([a-z]+)([A-Z]{1})/, '\1_\2').downcase
8
+ end
9
+
10
+ def to_camel
11
+ gsub(/([a-z]{1})_([a-z]{1})/) do |matched|
12
+ matched = matched.split("_")
13
+ matched[0] + matched[1].capitalize
14
+ end
15
+ end
16
+
17
+ def capitalize_from_snake
18
+ split("_").map(&:capitalize).join
19
+ end
20
+
21
+ def to_const
22
+ Object.const_get(self)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,34 @@
1
+ module RakutenTravelApi
2
+ module Structs
3
+ HotelBasicInfo = Struct.new(
4
+ :hotel_no,
5
+ :hotel_name,
6
+ :hotel_information_url,
7
+ :plan_list_url,
8
+ :dp_plan_list_url,
9
+ :review_url,
10
+ :hotel_kana_name,
11
+ :hotel_special,
12
+ :hotel_min_charge,
13
+ :latitude,
14
+ :longitude,
15
+ :postal_code,
16
+ :address1,
17
+ :address2,
18
+ :telephone_no,
19
+ :fax_no,
20
+ :access,
21
+ :parking_information,
22
+ :nearest_station,
23
+ :hotel_image_url,
24
+ :hotel_thumbnail_url,
25
+ :room_image_url,
26
+ :room_thumbnail_url,
27
+ :hotel_map_image_url,
28
+ :review_count,
29
+ :review_average,
30
+ :user_review,
31
+ keyword_init: true
32
+ )
33
+ end
34
+ end
@@ -0,0 +1,15 @@
1
+ module RakutenTravelApi
2
+ module Structs
3
+ HotelDetailInfo = Struct.new(
4
+ :reserve_telephone_no,
5
+ :middle_class_code,
6
+ :small_class_code,
7
+ :area_name,
8
+ :hotel_class_code,
9
+ :checkin_time,
10
+ :checkout_time,
11
+ :last_checkin_time,
12
+ keyword_init: true
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module RakutenTravelApi
2
+ module Structs
3
+ HotelFacilitiesInfo = Struct.new(
4
+ :hotel_room_num,
5
+ :room_facilities,
6
+ :hotel_facilities,
7
+ :about_meal_place,
8
+ :about_bath,
9
+ :about_leisure,
10
+ :handicapped_facilities,
11
+ :linguistic_level,
12
+ keyword_init: true
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module RakutenTravelApi
2
+ module Structs
3
+ HotelOtherInfo = Struct.new(
4
+ :privilege,
5
+ :other_information,
6
+ keyword_init: true
7
+ )
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module RakutenTravelApi
2
+ module Structs
3
+ HotelPolicyInfo = Struct.new(
4
+ :note,
5
+ :cancel_policy,
6
+ :available_credit_card,
7
+ :about_credit_card_note,
8
+ :about_point_add,
9
+ :about_mileage_add,
10
+ keyword_init: true
11
+ )
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module RakutenTravelApi
2
+ module Structs
3
+ HotelRatingInfo = Struct.new(
4
+ :service_average,
5
+ :location_average,
6
+ :room_average,
7
+ :equipment_average,
8
+ :bath_average,
9
+ :meal_average,
10
+ keyword_init: true
11
+ )
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RakutenTravelApi
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rakuten_travel_api/version"
4
+ require_relative "rakuten_travel_api/configuration"
5
+ require_relative "rakuten_travel_api/client"
6
+ require_relative "rakuten_travel_api/request"
7
+ require_relative "rakuten_travel_api/response"
8
+ require_relative "rakuten_travel_api/parameter"
9
+ require_relative "rakuten_travel_api/hotel"
10
+ require_relative "rakuten_travel_api/errors"
11
+ require_relative "rakuten_travel_api/structs/hotel_basic_info"
12
+ require_relative "rakuten_travel_api/structs/hotel_rating_info"
13
+ require_relative "rakuten_travel_api/structs/hotel_detail_info"
14
+ require_relative "rakuten_travel_api/structs/hotel_facilities_info"
15
+ require_relative "rakuten_travel_api/structs/hotel_policy_info"
16
+ require_relative "rakuten_travel_api/structs/hotel_other_info"
17
+
18
+ module RakutenTravelApi
19
+ extend RakutenTravelApi::Configuration
20
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rakuten_travel_api/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rakuten_travel_api"
7
+ spec.version = RakutenTravelApi::VERSION
8
+ spec.authors = ["RikuKomiya"]
9
+ spec.email = ["RikuKomiya@users.noreply.github.com"]
10
+
11
+ spec.summary = "This is API Client for rakuten travel api"
12
+ spec.description = "This is API Client for rakuten travel api"
13
+ spec.homepage = "https://github.com/RikuKomiya/rakuten_travel_api"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/RikuKomiya/rakuten_travel_api"
21
+ spec.metadata["changelog_uri"] = "https://github.com/RikuKomiya/rakuten_travel_api/blob/main/CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
@@ -0,0 +1,4 @@
1
+ module RakutenTravelApi
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rakuten_travel_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - RikuKomiya
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This is API Client for rakuten travel api
14
+ email:
15
+ - RikuKomiya@users.noreply.github.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - CHANGELOG.md
23
+ - CODE_OF_CONDUCT.md
24
+ - Gemfile
25
+ - Gemfile.lock
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - lib/rakuten_travel_api.rb
30
+ - lib/rakuten_travel_api/client.rb
31
+ - lib/rakuten_travel_api/configuration.rb
32
+ - lib/rakuten_travel_api/errors.rb
33
+ - lib/rakuten_travel_api/hotel.rb
34
+ - lib/rakuten_travel_api/parameter.rb
35
+ - lib/rakuten_travel_api/request.rb
36
+ - lib/rakuten_travel_api/response.rb
37
+ - lib/rakuten_travel_api/string_helper.rb
38
+ - lib/rakuten_travel_api/structs/hotel_basic_info.rb
39
+ - lib/rakuten_travel_api/structs/hotel_detail_info.rb
40
+ - lib/rakuten_travel_api/structs/hotel_facilities_info.rb
41
+ - lib/rakuten_travel_api/structs/hotel_other_info.rb
42
+ - lib/rakuten_travel_api/structs/hotel_policy_info.rb
43
+ - lib/rakuten_travel_api/structs/hotel_rating_info.rb
44
+ - lib/rakuten_travel_api/version.rb
45
+ - rakuten_travel_api.gemspec
46
+ - sig/rakuten_travel_api.rbs
47
+ homepage: https://github.com/RikuKomiya/rakuten_travel_api
48
+ licenses:
49
+ - MIT
50
+ metadata:
51
+ allowed_push_host: https://rubygems.org
52
+ homepage_uri: https://github.com/RikuKomiya/rakuten_travel_api
53
+ source_code_uri: https://github.com/RikuKomiya/rakuten_travel_api
54
+ changelog_uri: https://github.com/RikuKomiya/rakuten_travel_api/blob/main/CHANGELOG.md
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.6.0
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubygems_version: 3.3.7
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: This is API Client for rakuten travel api
74
+ test_files: []