app_manager 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 27423f35ef993aa4fc5716ea3725fce6d89592e091fed502814297a0d30537e5
4
+ data.tar.gz: f520e79e59f1a0e140caa5144062914e9b003a314c53b0226a6bea3c1ff3c70e
5
+ SHA512:
6
+ metadata.gz: 1693f542abdc932310c7b333047d34eb63922e2f72ba80cb4b4f3f9dea4de53aab3b46375e0ce0873e690f3508084420c0bfcb9f39581bfdd44fa25500a5ca5b
7
+ data.tar.gz: a426561b6301ab6756b632450b331fc95480ae2a4319cb27767e09a5549f8932eb7b98ca8dd2d53f2aac1269b1d361a451bd0725f7c02475d7782dd389eb2ef3
@@ -0,0 +1,42 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ env:
11
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
12
+ ACCESS_TOKEN_FAKE: ${{ secrets.ACCESS_TOKEN_FAKE }}
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ branches: [ master ]
19
+
20
+ jobs:
21
+ test:
22
+
23
+ runs-on: ubuntu-latest
24
+ strategy:
25
+ matrix:
26
+ ruby-version: ['2.7', '3.0']
27
+
28
+ steps:
29
+ - uses: actions/checkout@v3
30
+ - name: Set up Ruby
31
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
32
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
33
+ # uses: ruby/setup-ruby@v1
34
+ uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
35
+ with:
36
+ ruby-version: ${{ matrix.ruby-version }}
37
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
38
+ - name: Run tests
39
+ run: |
40
+ bundle install
41
+ bundle exec rspec spec
42
+
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.env
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
@@ -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 TODO: Write your email address. 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,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in app_manager.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "rubocop", "~> 1.7"
13
+
14
+
15
+ group :test do
16
+ gem 'pry'
17
+ gem 'rspec'
18
+ gem 'webmock'
19
+ gem 'rspec-github', require: false
20
+ gem 'dotenv', '~> 2.1.1'
21
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,232 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ app_manager (0.1.0)
5
+ httparty
6
+ rails (>= 5.2.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (7.0.2.3)
12
+ actionpack (= 7.0.2.3)
13
+ activesupport (= 7.0.2.3)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (7.0.2.3)
17
+ actionpack (= 7.0.2.3)
18
+ activejob (= 7.0.2.3)
19
+ activerecord (= 7.0.2.3)
20
+ activestorage (= 7.0.2.3)
21
+ activesupport (= 7.0.2.3)
22
+ mail (>= 2.7.1)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.0.2.3)
27
+ actionpack (= 7.0.2.3)
28
+ actionview (= 7.0.2.3)
29
+ activejob (= 7.0.2.3)
30
+ activesupport (= 7.0.2.3)
31
+ mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
35
+ rails-dom-testing (~> 2.0)
36
+ actionpack (7.0.2.3)
37
+ actionview (= 7.0.2.3)
38
+ activesupport (= 7.0.2.3)
39
+ rack (~> 2.0, >= 2.2.0)
40
+ rack-test (>= 0.6.3)
41
+ rails-dom-testing (~> 2.0)
42
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
+ actiontext (7.0.2.3)
44
+ actionpack (= 7.0.2.3)
45
+ activerecord (= 7.0.2.3)
46
+ activestorage (= 7.0.2.3)
47
+ activesupport (= 7.0.2.3)
48
+ globalid (>= 0.6.0)
49
+ nokogiri (>= 1.8.5)
50
+ actionview (7.0.2.3)
51
+ activesupport (= 7.0.2.3)
52
+ builder (~> 3.1)
53
+ erubi (~> 1.4)
54
+ rails-dom-testing (~> 2.0)
55
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
+ activejob (7.0.2.3)
57
+ activesupport (= 7.0.2.3)
58
+ globalid (>= 0.3.6)
59
+ activemodel (7.0.2.3)
60
+ activesupport (= 7.0.2.3)
61
+ activerecord (7.0.2.3)
62
+ activemodel (= 7.0.2.3)
63
+ activesupport (= 7.0.2.3)
64
+ activestorage (7.0.2.3)
65
+ actionpack (= 7.0.2.3)
66
+ activejob (= 7.0.2.3)
67
+ activerecord (= 7.0.2.3)
68
+ activesupport (= 7.0.2.3)
69
+ marcel (~> 1.0)
70
+ mini_mime (>= 1.1.0)
71
+ activesupport (7.0.2.3)
72
+ concurrent-ruby (~> 1.0, >= 1.0.2)
73
+ i18n (>= 1.6, < 2)
74
+ minitest (>= 5.1)
75
+ tzinfo (~> 2.0)
76
+ addressable (2.8.0)
77
+ public_suffix (>= 2.0.2, < 5.0)
78
+ ast (2.4.2)
79
+ builder (3.2.4)
80
+ coderay (1.1.3)
81
+ concurrent-ruby (1.1.10)
82
+ crack (0.4.5)
83
+ rexml
84
+ crass (1.0.6)
85
+ diff-lcs (1.5.0)
86
+ digest (3.1.0)
87
+ dotenv (2.1.2)
88
+ erubi (1.10.0)
89
+ globalid (1.0.0)
90
+ activesupport (>= 5.0)
91
+ hashdiff (1.0.1)
92
+ httparty (0.20.0)
93
+ mime-types (~> 3.0)
94
+ multi_xml (>= 0.5.2)
95
+ i18n (1.10.0)
96
+ concurrent-ruby (~> 1.0)
97
+ io-wait (0.2.1)
98
+ loofah (2.15.0)
99
+ crass (~> 1.0.2)
100
+ nokogiri (>= 1.5.9)
101
+ mail (2.7.1)
102
+ mini_mime (>= 0.1.1)
103
+ marcel (1.0.2)
104
+ method_source (1.0.0)
105
+ mime-types (3.4.1)
106
+ mime-types-data (~> 3.2015)
107
+ mime-types-data (3.2022.0105)
108
+ mini_mime (1.1.2)
109
+ mini_portile2 (2.8.0)
110
+ minitest (5.15.0)
111
+ multi_xml (0.6.0)
112
+ net-imap (0.2.3)
113
+ digest
114
+ net-protocol
115
+ strscan
116
+ net-pop (0.1.1)
117
+ digest
118
+ net-protocol
119
+ timeout
120
+ net-protocol (0.1.2)
121
+ io-wait
122
+ timeout
123
+ net-smtp (0.3.1)
124
+ digest
125
+ net-protocol
126
+ timeout
127
+ nio4r (2.5.8)
128
+ nokogiri (1.13.3)
129
+ mini_portile2 (~> 2.8.0)
130
+ racc (~> 1.4)
131
+ nokogiri (1.13.3-x86_64-linux)
132
+ racc (~> 1.4)
133
+ parallel (1.22.0)
134
+ parser (3.1.1.0)
135
+ ast (~> 2.4.1)
136
+ pry (0.14.1)
137
+ coderay (~> 1.1)
138
+ method_source (~> 1.0)
139
+ public_suffix (4.0.6)
140
+ racc (1.6.0)
141
+ rack (2.2.3)
142
+ rack-test (1.1.0)
143
+ rack (>= 1.0, < 3)
144
+ rails (7.0.2.3)
145
+ actioncable (= 7.0.2.3)
146
+ actionmailbox (= 7.0.2.3)
147
+ actionmailer (= 7.0.2.3)
148
+ actionpack (= 7.0.2.3)
149
+ actiontext (= 7.0.2.3)
150
+ actionview (= 7.0.2.3)
151
+ activejob (= 7.0.2.3)
152
+ activemodel (= 7.0.2.3)
153
+ activerecord (= 7.0.2.3)
154
+ activestorage (= 7.0.2.3)
155
+ activesupport (= 7.0.2.3)
156
+ bundler (>= 1.15.0)
157
+ railties (= 7.0.2.3)
158
+ rails-dom-testing (2.0.3)
159
+ activesupport (>= 4.2.0)
160
+ nokogiri (>= 1.6)
161
+ rails-html-sanitizer (1.4.2)
162
+ loofah (~> 2.3)
163
+ railties (7.0.2.3)
164
+ actionpack (= 7.0.2.3)
165
+ activesupport (= 7.0.2.3)
166
+ method_source
167
+ rake (>= 12.2)
168
+ thor (~> 1.0)
169
+ zeitwerk (~> 2.5)
170
+ rainbow (3.1.1)
171
+ rake (13.0.6)
172
+ regexp_parser (2.2.1)
173
+ rexml (3.2.5)
174
+ rspec (3.11.0)
175
+ rspec-core (~> 3.11.0)
176
+ rspec-expectations (~> 3.11.0)
177
+ rspec-mocks (~> 3.11.0)
178
+ rspec-core (3.11.0)
179
+ rspec-support (~> 3.11.0)
180
+ rspec-expectations (3.11.0)
181
+ diff-lcs (>= 1.2.0, < 2.0)
182
+ rspec-support (~> 3.11.0)
183
+ rspec-github (2.3.1)
184
+ rspec-core (~> 3.0)
185
+ rspec-mocks (3.11.0)
186
+ diff-lcs (>= 1.2.0, < 2.0)
187
+ rspec-support (~> 3.11.0)
188
+ rspec-support (3.11.0)
189
+ rubocop (1.26.1)
190
+ parallel (~> 1.10)
191
+ parser (>= 3.1.0.0)
192
+ rainbow (>= 2.2.2, < 4.0)
193
+ regexp_parser (>= 1.8, < 3.0)
194
+ rexml
195
+ rubocop-ast (>= 1.16.0, < 2.0)
196
+ ruby-progressbar (~> 1.7)
197
+ unicode-display_width (>= 1.4.0, < 3.0)
198
+ rubocop-ast (1.16.0)
199
+ parser (>= 3.1.1.0)
200
+ ruby-progressbar (1.11.0)
201
+ strscan (3.0.1)
202
+ thor (1.2.1)
203
+ timeout (0.2.0)
204
+ tzinfo (2.0.4)
205
+ concurrent-ruby (~> 1.0)
206
+ unicode-display_width (2.1.0)
207
+ webmock (3.14.0)
208
+ addressable (>= 2.8.0)
209
+ crack (>= 0.3.2)
210
+ hashdiff (>= 0.4.0, < 2.0.0)
211
+ websocket-driver (0.7.5)
212
+ websocket-extensions (>= 0.1.0)
213
+ websocket-extensions (0.1.5)
214
+ zeitwerk (2.5.4)
215
+
216
+ PLATFORMS
217
+ ruby
218
+ x86_64-linux
219
+
220
+ DEPENDENCIES
221
+ app_manager!
222
+ dotenv (~> 2.1.1)
223
+ minitest (~> 5.0)
224
+ pry
225
+ rake (~> 13.0)
226
+ rspec
227
+ rspec-github
228
+ rubocop (~> 1.7)
229
+ webmock
230
+
231
+ BUNDLED WITH
232
+ 2.2.22
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # AppManager
2
+
3
+ Welcome to your new gem! An API wrapper of Hulkapps.com AppManager portal.
4
+
5
+ ## Installation
6
+
7
+ Step 1) Run this command to your rails project root (Please replace ACCESS_TOKEN_GITHUB from your github token to access this repo) :
8
+
9
+ bundle config --local GITHUB__COM x___access___token:ACCESS_TOKEN_GITHUB
10
+
11
+
12
+ Step 2) Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'app_manager', git: "https://github.com/HulkApps/app-manager-sdk-ruby.git"
16
+ ```
17
+
18
+ Step 3) And then execute:
19
+
20
+ bundle install
21
+
22
+
23
+ rails g app_manager:install
24
+
25
+
26
+ this install command will mount routes in your rails route.
27
+
28
+
29
+ Step 4) You must have to set ENV variable with key 'ACCESS_TOKEN_APP_MANAGER_PORTAL' in your application.yml or .env file like this:
30
+
31
+ APP_MANAGER_ACCESS_TOKEN: 'XXXXXXXXXXXXXXXXXXX'
32
+
33
+ ## Usage
34
+
35
+ #### As a helper:
36
+
37
+
38
+ Then, initialize app_manager instance like with App Manager Portal access:
39
+
40
+ ```ruby
41
+ ob = AppManager::Client.new('ACCESS_TOKEN_APP_MANAGER_PORTAL')
42
+ ```
43
+
44
+ To get banners use this command:
45
+ ```ruby
46
+ ob.get_banners
47
+ ```
48
+
49
+ #### For Vue UI Library in Rails Project:
50
+
51
+ Please make sure you have following line in your route file otherwise add this manually.
52
+
53
+ mount AppManager::Engine, at: "/"
54
+
55
+
56
+ ## Development
57
+
58
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
59
+
60
+ 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).
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/app_manager. 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]/app_manager/blob/master/CODE_OF_CONDUCT.md).
65
+
66
+ ## Code of Conduct
67
+
68
+ Everyone interacting in the AppManager project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/app_manager/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ # require "rubocop/rake_task"
13
+
14
+ # RuboCop::RakeTask.new
15
+
16
+ # task default: %i[test rubocop]
@@ -0,0 +1,5 @@
1
+ module AppManager
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require_dependency "app_manager/application_controller"
2
+
3
+ module AppManager
4
+ class BannersController < ApplicationController
5
+ def marketing_banner
6
+ banner_obj = AppManager::Client.new
7
+ render json: banner_obj.get_banners
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/app_manager/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "app_manager"
7
+ spec.version = AppManager::VERSION
8
+ spec.authors = "Hulkapps"
9
+ spec.email = "rahul.t@hulkapps.com"
10
+
11
+ spec.summary = "An API wrapper of Hulkapps AppManager portal"
12
+ spec.description = "Provides helper function to access AppManager API"
13
+ spec.homepage = "https://www.hulkapps.com"
14
+ spec.required_ruby_version = ">= 2.4.0"
15
+
16
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
17
+
18
+ # spec.metadata["homepage_uri"] = spec.homepage
19
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
20
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ # Uncomment to register a new dependency of your gem
32
+ # spec.add_dependency "example-gem", "~> 1.0"
33
+ spec.add_dependency "httparty"
34
+ spec.add_dependency "rails", ">= 5.2.0"
35
+
36
+
37
+ # For more information and examples about making a new gem, checkout our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "app_manager"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ AppManager::Engine.routes.draw do
2
+ scope 'api/app-manager' do
3
+ get 'marketing-banners' => 'banners#marketing_banner'
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module AppManager
2
+ class Client
3
+ module Banners
4
+
5
+ def get_banners(options = {})
6
+ get("/static-contents", options)
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,45 @@
1
+ module AppManager
2
+
3
+ class Client
4
+
5
+ module Connection
6
+
7
+ def get(path, options = {})
8
+ request :get, path, options
9
+ end
10
+
11
+ def post(path, options = {})
12
+ request :post, path, options
13
+ end
14
+
15
+ def put(path, options = {})
16
+ request :put, path, options
17
+ end
18
+
19
+ def delete(path, options = {})
20
+ request :delete, path, options
21
+ end
22
+
23
+ private
24
+
25
+ def request(http_method, path, options)
26
+ response = self.class.send(http_method, path, { body: options })
27
+ return nil unless response
28
+ data = response.parsed_response
29
+ data = parse_data(response.parsed_response)
30
+ end
31
+
32
+ def parse_data(original_data)
33
+ return unless original_data
34
+ if (original_data.class == Hash) && original_data.key?("headers") && original_data.key?("footers") && original_data.key?("modal")
35
+ return {"banners" => original_data}
36
+ else
37
+ return original_data
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,24 @@
1
+ require "app_manager/client/connection"
2
+ require "app_manager/client/banners"
3
+
4
+ module AppManager
5
+ class Client
6
+ include HTTParty
7
+ include AppManager::Client::Connection
8
+ include AppManager::Client::Banners
9
+
10
+
11
+ # debug_output $stderr if Rails.env.development?
12
+ base_uri "https://app-manager.hulkapps.dev/api"
13
+ format :json
14
+
15
+
16
+ def initialize(access_token = nil)
17
+ access_token ||= ENV["APP_MANAGER_ACCESS_TOKEN"]
18
+ self.class.default_options.merge!(headers: { 'token' => "#{access_token}" })
19
+ end
20
+
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,6 @@
1
+ module AppManager
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace AppManager # this is generally recommended
4
+
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppManager
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "httparty"
4
+ require "rails"
5
+ require "app_manager/version"
6
+ require "app_manager/engine"
7
+ require "app_manager/client"
8
+
9
+
10
+ module AppManager
11
+ # Your code goes here...
12
+ end
@@ -0,0 +1,13 @@
1
+ require "rails/generators/base"
2
+ module AppManager
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def mount_engine
8
+ route("mount AppManager::Engine, at: '/'")
9
+ end
10
+
11
+ end
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: app_manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Hulkapps
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 5.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 5.2.0
41
+ description: Provides helper function to access AppManager API
42
+ email: rahul.t@hulkapps.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ".github/workflows/ruby.yml"
48
+ - ".gitignore"
49
+ - ".rubocop.yml"
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - README.md
54
+ - Rakefile
55
+ - app/controllers/app_manager/application_controller.rb
56
+ - app/controllers/app_manager/banners_controller.rb
57
+ - app_manager.gemspec
58
+ - bin/console
59
+ - bin/setup
60
+ - config/routes.rb
61
+ - lib/app_manager.rb
62
+ - lib/app_manager/client.rb
63
+ - lib/app_manager/client/banners.rb
64
+ - lib/app_manager/client/connection.rb
65
+ - lib/app_manager/engine.rb
66
+ - lib/app_manager/version.rb
67
+ - lib/generators/app_manager/install/install_generator.rb
68
+ homepage: https://www.hulkapps.com
69
+ licenses: []
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 2.4.0
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.1.2
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: An API wrapper of Hulkapps AppManager portal
90
+ test_files: []