airlinefyi 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/lib/airlinefyi.rb +170 -0
- metadata +47 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 960b838995319731231c8699125933307df6822e215bfecde414700c6f7c5477
|
|
4
|
+
data.tar.gz: 36605aa275c3a81eae808747d092c9a39181c108fcc36d003ec6d76d2d4a9dc4
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 26e5da58f54453cea1eba3d599a558dfa261b5dc9b9dd8eba5fd7641845315875fa3ca5644a978804acc54380a2db3e9f709ecb4cf54e3ac53f01190388c7dff
|
|
7
|
+
data.tar.gz: f4f2570950a4299471667ff72e46812ee0df6c0fc9755462b90633a064b5615dbf5d3338eb0df0a3cb61e4f003274170c75f2d539589199d5d45a1ad57c69f23
|
data/lib/airlinefyi.rb
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
# Ruby client for AirlineFYI REST API (airlinefyi.com).
|
|
8
|
+
#
|
|
9
|
+
# client = AirlineFYI::Client.new
|
|
10
|
+
# result = client.search("query")
|
|
11
|
+
#
|
|
12
|
+
module AirlineFYI
|
|
13
|
+
class Client
|
|
14
|
+
BASE_URL = "https://airlinefyi.com"
|
|
15
|
+
|
|
16
|
+
def initialize(base_url: BASE_URL)
|
|
17
|
+
@base_url = base_url
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def search(query)
|
|
21
|
+
get("/api/v1/search/", q: query)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# List all airlines.
|
|
25
|
+
def list_airlines
|
|
26
|
+
get("/api/v1/airlines/")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Get airline by slug.
|
|
30
|
+
def get_airline(slug)
|
|
31
|
+
get("/api/v1/airlines/#{slug}/")
|
|
32
|
+
end
|
|
33
|
+
# List all airports.
|
|
34
|
+
def list_airports
|
|
35
|
+
get("/api/v1/airports/")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get airport by slug.
|
|
39
|
+
def get_airport(slug)
|
|
40
|
+
get("/api/v1/airports/#{slug}/")
|
|
41
|
+
end
|
|
42
|
+
# List all brief series.
|
|
43
|
+
def list_brief_series
|
|
44
|
+
get("/api/v1/brief-series/")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get brief sery by slug.
|
|
48
|
+
def get_brief_sery(slug)
|
|
49
|
+
get("/api/v1/brief-series/#{slug}/")
|
|
50
|
+
end
|
|
51
|
+
# List all cabin products.
|
|
52
|
+
def list_cabin_products
|
|
53
|
+
get("/api/v1/cabin-products/")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Get cabin product by slug.
|
|
57
|
+
def get_cabin_product(slug)
|
|
58
|
+
get("/api/v1/cabin-products/#{slug}/")
|
|
59
|
+
end
|
|
60
|
+
# List all countries.
|
|
61
|
+
def list_countries
|
|
62
|
+
get("/api/v1/countries/")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Get country by slug.
|
|
66
|
+
def get_country(slug)
|
|
67
|
+
get("/api/v1/countries/#{slug}/")
|
|
68
|
+
end
|
|
69
|
+
# List all faqs.
|
|
70
|
+
def list_faqs
|
|
71
|
+
get("/api/v1/faqs/")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Get faq by slug.
|
|
75
|
+
def get_faq(slug)
|
|
76
|
+
get("/api/v1/faqs/#{slug}/")
|
|
77
|
+
end
|
|
78
|
+
# List all flight corridors.
|
|
79
|
+
def list_flight_corridors
|
|
80
|
+
get("/api/v1/flight-corridors/")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Get flight corridor by slug.
|
|
84
|
+
def get_flight_corridor(slug)
|
|
85
|
+
get("/api/v1/flight-corridors/#{slug}/")
|
|
86
|
+
end
|
|
87
|
+
# List all flights.
|
|
88
|
+
def list_flights
|
|
89
|
+
get("/api/v1/flights/")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Get flight by slug.
|
|
93
|
+
def get_flight(slug)
|
|
94
|
+
get("/api/v1/flights/#{slug}/")
|
|
95
|
+
end
|
|
96
|
+
# List all glossary.
|
|
97
|
+
def list_glossary
|
|
98
|
+
get("/api/v1/glossary/")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Get term by slug.
|
|
102
|
+
def get_term(slug)
|
|
103
|
+
get("/api/v1/glossary/#{slug}/")
|
|
104
|
+
end
|
|
105
|
+
# List all guide series.
|
|
106
|
+
def list_guide_series
|
|
107
|
+
get("/api/v1/guide-series/")
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Get guide sery by slug.
|
|
111
|
+
def get_guide_sery(slug)
|
|
112
|
+
get("/api/v1/guide-series/#{slug}/")
|
|
113
|
+
end
|
|
114
|
+
# List all guides.
|
|
115
|
+
def list_guides
|
|
116
|
+
get("/api/v1/guides/")
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Get guide by slug.
|
|
120
|
+
def get_guide(slug)
|
|
121
|
+
get("/api/v1/guides/#{slug}/")
|
|
122
|
+
end
|
|
123
|
+
# List all hub profiles.
|
|
124
|
+
def list_hub_profiles
|
|
125
|
+
get("/api/v1/hub-profiles/")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Get hub profile by slug.
|
|
129
|
+
def get_hub_profile(slug)
|
|
130
|
+
get("/api/v1/hub-profiles/#{slug}/")
|
|
131
|
+
end
|
|
132
|
+
# List all industry briefs.
|
|
133
|
+
def list_industry_briefs
|
|
134
|
+
get("/api/v1/industry-briefs/")
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Get industry brief by slug.
|
|
138
|
+
def get_industry_brief(slug)
|
|
139
|
+
get("/api/v1/industry-briefs/#{slug}/")
|
|
140
|
+
end
|
|
141
|
+
# List all loyalty programs.
|
|
142
|
+
def list_loyalty_programs
|
|
143
|
+
get("/api/v1/loyalty-programs/")
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Get loyalty program by slug.
|
|
147
|
+
def get_loyalty_program(slug)
|
|
148
|
+
get("/api/v1/loyalty-programs/#{slug}/")
|
|
149
|
+
end
|
|
150
|
+
# List all tools.
|
|
151
|
+
def list_tools
|
|
152
|
+
get("/api/v1/tools/")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Get tool by slug.
|
|
156
|
+
def get_tool(slug)
|
|
157
|
+
get("/api/v1/tools/#{slug}/")
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
private
|
|
161
|
+
|
|
162
|
+
def get(path, **params)
|
|
163
|
+
uri = URI.join(@base_url, path)
|
|
164
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
165
|
+
response = Net::HTTP.get_response(uri)
|
|
166
|
+
raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
167
|
+
JSON.parse(response.body)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: airlinefyi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- FYIPedia
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Ruby client for the AirlineFYI REST API at airlinefyi.com. Zero external
|
|
14
|
+
dependencies.
|
|
15
|
+
email: dev@fyipedia.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/airlinefyi.rb
|
|
21
|
+
homepage: https://airlinefyi.com
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata:
|
|
25
|
+
source_code_uri: https://github.com/fyipedia/airlinefyi-rb
|
|
26
|
+
documentation_uri: https://airlinefyi.com/api/v1/schema/
|
|
27
|
+
homepage_uri: https://airlinefyi.com
|
|
28
|
+
post_install_message:
|
|
29
|
+
rdoc_options: []
|
|
30
|
+
require_paths:
|
|
31
|
+
- lib
|
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '3.0'
|
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '0'
|
|
42
|
+
requirements: []
|
|
43
|
+
rubygems_version: 3.0.3.1
|
|
44
|
+
signing_key:
|
|
45
|
+
specification_version: 4
|
|
46
|
+
summary: Ruby client for AirlineFYI API
|
|
47
|
+
test_files: []
|