salaryfyi 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/salaryfyi.rb +80 -0
- metadata +47 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2875e1efe38713dd3ddcb81ea32d0987c3040931639e1da8183a0c5198a23a95
|
|
4
|
+
data.tar.gz: 8e02c6a3675c1a3bf8fcda90c284f4630b2cc000344b829959c11c74638d7798
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3946bb685bd5c582986b162fbbec66614dce6b3fce14fcc189ea263d7474eeae1e7c6bf673c0ad099987ffcd5850bebf2509be8f5e6ca6dff7cc368690423d00
|
|
7
|
+
data.tar.gz: ac9dd655a2fe195e879c819caab7579e4252ba5640cd937d31881640d42835e86248363bb28ea65d5783df124dcc9331fd3d8bc207c8178596b0ee1c839245bc
|
data/lib/salaryfyi.rb
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
# Ruby client for SalaryFYI REST API (salaryfyi.com).
|
|
8
|
+
#
|
|
9
|
+
# client = SalaryFYI::Client.new
|
|
10
|
+
# result = client.search("query")
|
|
11
|
+
#
|
|
12
|
+
module SalaryFYI
|
|
13
|
+
class Client
|
|
14
|
+
BASE_URL = "https://salaryfyi.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 calculators.
|
|
25
|
+
def list_calculators
|
|
26
|
+
get("/api/v1/calculators/")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Get calculator by slug.
|
|
30
|
+
def get_calculator(slug)
|
|
31
|
+
get("/api/v1/calculators/#{slug}/")
|
|
32
|
+
end
|
|
33
|
+
# List all categories.
|
|
34
|
+
def list_categories
|
|
35
|
+
get("/api/v1/categories/")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get category by slug.
|
|
39
|
+
def get_category(slug)
|
|
40
|
+
get("/api/v1/categories/#{slug}/")
|
|
41
|
+
end
|
|
42
|
+
# List all countries.
|
|
43
|
+
def list_countries
|
|
44
|
+
get("/api/v1/countries/")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get country by slug.
|
|
48
|
+
def get_country(slug)
|
|
49
|
+
get("/api/v1/countries/#{slug}/")
|
|
50
|
+
end
|
|
51
|
+
# List all faqs.
|
|
52
|
+
def list_faqs
|
|
53
|
+
get("/api/v1/faqs/")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Get faq by slug.
|
|
57
|
+
def get_faq(slug)
|
|
58
|
+
get("/api/v1/faqs/#{slug}/")
|
|
59
|
+
end
|
|
60
|
+
# List all guides.
|
|
61
|
+
def list_guides
|
|
62
|
+
get("/api/v1/guides/")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Get guide by slug.
|
|
66
|
+
def get_guide(slug)
|
|
67
|
+
get("/api/v1/guides/#{slug}/")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def get(path, **params)
|
|
73
|
+
uri = URI.join(@base_url, path)
|
|
74
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
75
|
+
response = Net::HTTP.get_response(uri)
|
|
76
|
+
raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
77
|
+
JSON.parse(response.body)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: salaryfyi
|
|
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 SalaryFYI REST API at salaryfyi.com. Zero external
|
|
14
|
+
dependencies.
|
|
15
|
+
email: dev@fyipedia.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/salaryfyi.rb
|
|
21
|
+
homepage: https://salaryfyi.com
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata:
|
|
25
|
+
source_code_uri: https://github.com/fyipedia/salaryfyi-rb
|
|
26
|
+
documentation_uri: https://salaryfyi.com/api/v1/schema/
|
|
27
|
+
homepage_uri: https://salaryfyi.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 SalaryFYI API
|
|
47
|
+
test_files: []
|