moloni_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.
data/lib/moloni_api.rb ADDED
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+ require 'oj'
5
+ require_relative 'moloni_api/version'
6
+
7
+ module MoloniApi
8
+ # Base module for Moloni API
9
+ class Error < StandardError; end
10
+
11
+ LIBNAME = 'moloni_api'
12
+
13
+ LIBDIR = File.expand_path(LIBNAME.to_s, __dir__)
14
+
15
+ class << self
16
+ # The client configuration
17
+ #
18
+ # @return [Configuration]
19
+ #
20
+ # @api public
21
+ def configuration
22
+ @configuration ||= Configuration.new
23
+ end
24
+
25
+ alias config configuration
26
+
27
+ # Configure options
28
+ #
29
+ # @example
30
+ # MoloniApi.configure do |c|
31
+ # c.some_option = true
32
+ # end
33
+ #
34
+ # @yield the configuration block
35
+ # @yieldparam configuration [MoloniApi::Configuration]
36
+ # the configuration instance
37
+ #
38
+ # @return [nil]
39
+ #
40
+ # @api public
41
+ def configure
42
+ yield configuration
43
+ end
44
+
45
+ # Alias for MoloniApi::Client.new
46
+ #
47
+ # @param [Hash] options
48
+ # the configuration options
49
+ #
50
+ # @return [MoloniApi::Client]
51
+ #
52
+ # @api public
53
+ def new(options = {}, &block)
54
+ Client.new(options, &block)
55
+ end
56
+
57
+ # Default middleware stack that uses default adapter as specified
58
+ # by configuration setup
59
+ #
60
+ # @return [Proc]
61
+ #
62
+ # @api private
63
+ def default_middleware(options = {})
64
+ Middleware.default(options)
65
+ end
66
+
67
+ # Delegate to MoloniApi::Client
68
+ #
69
+ # @api private
70
+ def method_missing(method_name, *args, &block)
71
+ if new.respond_to?(method_name)
72
+ new.send(method_name, *args, &block)
73
+ elsif configuration.respond_to?(method_name)
74
+ MoloniApi.configuration.send(method_name, *args, &block)
75
+ else
76
+ super.respond_to_missing?
77
+ end
78
+ end
79
+
80
+ def respond_to_missing?(method_name, include_private = false)
81
+ new.respond_to?(method_name, include_private) ||
82
+ configuration.respond_to?(method_name) ||
83
+ super(method_name, include_private)
84
+ end
85
+ end
86
+ end
87
+
88
+ require_relative 'moloni_api/client'
89
+ require_relative 'moloni_api/configuration'
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/moloni_api/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'moloni_api'
7
+ spec.version = MoloniApi::VERSION
8
+ spec.authors = ['Dinis']
9
+ spec.email = ['dinis@lage.pw']
10
+
11
+ spec.summary = 'FantasticStay API Wrapper.'
12
+ spec.description = 'A gem that implements functions from the FS API available for its users.'
13
+ spec.homepage = 'https://github.com/dlage/moloni_api_gem'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.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/dlage/moloni_api_gem'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/dlage/moloni_api_gem/blob/master/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 { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+ spec.add_dependency 'faraday', '~> 1.3.0'
35
+ spec.add_dependency 'oj', '~> 3.11'
36
+ # spec.add_dependency 'dry-configurable', '~> 0.12.1'
37
+
38
+ # For more information and examples about making a new gem, checkout our
39
+ # guide at: https://bundler.io/guides/creating_gem.html
40
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moloni_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dinis
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: oj
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.11'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.11'
41
+ description: A gem that implements functions from the FS API available for its users.
42
+ email:
43
+ - dinis@lage.pw
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".github/workflows/main.yml"
49
+ - ".gitignore"
50
+ - ".rspec"
51
+ - ".rubocop.yml"
52
+ - CHANGELOG.md
53
+ - CODE_OF_CONDUCT.md
54
+ - Dockerfile
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - bin/console
61
+ - bin/setup
62
+ - docker-compose.yml
63
+ - lib/moloni_api.rb
64
+ - lib/moloni_api/api.rb
65
+ - lib/moloni_api/api/config.rb
66
+ - lib/moloni_api/api/config/property.rb
67
+ - lib/moloni_api/api/config/property_set.rb
68
+ - lib/moloni_api/api_exceptions.rb
69
+ - lib/moloni_api/client.rb
70
+ - lib/moloni_api/configuration.rb
71
+ - lib/moloni_api/constants.rb
72
+ - lib/moloni_api/http_status_codes.rb
73
+ - lib/moloni_api/models/product.rb
74
+ - lib/moloni_api/version.rb
75
+ - moloni_api.gemspec
76
+ homepage: https://github.com/dlage/moloni_api_gem
77
+ licenses:
78
+ - MIT
79
+ metadata:
80
+ allowed_push_host: https://rubygems.org
81
+ homepage_uri: https://github.com/dlage/moloni_api_gem
82
+ source_code_uri: https://github.com/dlage/moloni_api_gem
83
+ changelog_uri: https://github.com/dlage/moloni_api_gem/blob/master/CHANGELOG.md
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 2.4.0
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubygems_version: 3.3.19
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: FantasticStay API Wrapper.
103
+ test_files: []