fastlane-plugin-http_request 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: 3f8b1cc42c3d77db038cd3b2ccb2c94ebb2a8c43bb06e1cad752758d74fb7f97
4
+ data.tar.gz: a61a9bb1c96afcd872d628bec698012afad2c3b002941e5c038f3b6443445641
5
+ SHA512:
6
+ metadata.gz: b5ff69627599b58a6a8313dd3073bd93a0c249a38006c77343cb5bddcdabf7d4e443be484e10f34da0a38da9da6bcfbd689a20ff7979642558320ae7ff09d6f1
7
+ data.tar.gz: efc46551a999f320290262284f3f108b5d4a920ee8664a46eb446325fb7532adcf40af30088174f61a643d8f532c4d72af51fceaecea7e02d5d29535b3147a6e
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Angelo Cassano
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # http_request plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-http_request)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-http_request`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin http_request
11
+ ```
12
+
13
+ ## About http_request
14
+
15
+ Fastlane plugin to send http requests
16
+
17
+ * Supports GET, POST, PUT, PATCH, and DELETE
18
+ * Handles JSON or raw body payloads
19
+ * Optional timeout and verbose logging
20
+ * Gracefully handles errors and unsupported methods
21
+ * Returns structured data:
22
+ ```
23
+ {
24
+ code: 200,
25
+ body: {...},
26
+ headers: {...}
27
+ }
28
+ ```
29
+
30
+ ## Example
31
+
32
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
33
+
34
+ ```
35
+ lane :test do
36
+ response = http_request(
37
+ url: "https://httpbin.io/post",
38
+ method: "POST",
39
+ headers: { "Content-Type" => "application/json" },
40
+ body: {
41
+ app: "appName",
42
+ version: "1.0",
43
+ build: 123,
44
+ environment: "production"
45
+ },
46
+ verbose: true
47
+ )
48
+
49
+ UI.message("Webhook returned code: #{response[:code]}")
50
+ UI.message("Response: #{response[:body]}")
51
+ end
52
+ ```
53
+
54
+ ## Run tests for this plugin
55
+
56
+ To run both the tests, and code style validation, run
57
+
58
+ ```
59
+ rake
60
+ ```
61
+
62
+ To automatically fix many of the styling issues, use
63
+ ```
64
+ rubocop -a
65
+ ```
66
+
67
+ ## Issues and Feedback
68
+
69
+ For any other issues and feedback about this plugin, please submit it to this repository.
70
+
71
+ ## Troubleshooting
72
+
73
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
74
+
75
+ ## Using _fastlane_ Plugins
76
+
77
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
78
+
79
+ ## About _fastlane_
80
+
81
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,122 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane_core/configuration/config_item'
3
+ require 'fastlane_core/ui/ui'
4
+ require 'json'
5
+ require_relative '../helper/http_request_helper'
6
+
7
+ UI = FastlaneCore::UI unless defined?(UI)
8
+
9
+ module Fastlane
10
+ module Actions
11
+ class HttpRequestAction < Action
12
+ def self.run(params)
13
+ uri = URI.parse(params[:url])
14
+ method = params[:method].to_s.upcase
15
+ headers = params[:headers] || {}
16
+ body = params[:body]
17
+ timeout = params[:timeout] || 30
18
+ verbose = params[:verbose] || false
19
+
20
+ UI.message("➡️ Sending HTTP #{method} request to #{uri}")
21
+
22
+ response = Helper::HttpRequestHelper.perform_request(uri, method, headers, body, timeout)
23
+
24
+ handle_response(response, verbose)
25
+ rescue StandardError => e
26
+ UI.user_error!("HTTP request failed: #{e.message}")
27
+ end
28
+
29
+ def self.handle_response(response, verbose)
30
+ UI.success("✅ HTTP #{response.code} #{response.message}")
31
+ UI.message("Response body: #{response.body[0..500]}") if verbose && response.body
32
+
33
+ raw_body = response.body || ""
34
+
35
+ parsed_body = begin
36
+ JSON.parse(raw_body)
37
+ rescue JSON::ParserError
38
+ raw_body
39
+ end
40
+
41
+ {
42
+ code: response.code.to_i,
43
+ body: parsed_body,
44
+ headers: response.each_header.to_h
45
+ }
46
+ end
47
+
48
+ # Plugin description
49
+ def self.description
50
+ "Fastlane plugin to send HTTP requests (GET, POST, PUT, DELETE, etc.)"
51
+ end
52
+
53
+ # Optional detailed description
54
+ def self.details
55
+ "A general-purpose HTTP request action for Fastlane, allowing you to call APIs or webhooks from your lanes."
56
+ end
57
+
58
+ def self.authors
59
+ ["Angelo Cassano"]
60
+ end
61
+
62
+ def self.return_value
63
+ "A hash containing :code (Integer), :body (Hash or String), and :headers (Hash) from the HTTP response."
64
+ end
65
+
66
+ # Configurable parameters for the action
67
+ def self.available_options
68
+ [
69
+ FastlaneCore::ConfigItem.new(
70
+ key: :url,
71
+ env_name: "HTTP_REQUEST_URL",
72
+ description: "The target URL for the HTTP request",
73
+ optional: false,
74
+ type: String
75
+ ),
76
+ FastlaneCore::ConfigItem.new(
77
+ key: :method,
78
+ env_name: "HTTP_REQUEST_METHOD",
79
+ description: "HTTP method to use (GET, POST, PUT, PATCH, DELETE)",
80
+ optional: true,
81
+ default_value: "GET",
82
+ type: String
83
+ ),
84
+ FastlaneCore::ConfigItem.new(
85
+ key: :headers,
86
+ env_name: "HTTP_REQUEST_HEADERS",
87
+ description: "Optional HTTP headers as a Ruby hash",
88
+ optional: true,
89
+ type: Hash
90
+ ),
91
+ FastlaneCore::ConfigItem.new(
92
+ key: :body,
93
+ env_name: "HTTP_REQUEST_BODY",
94
+ description: "Optional HTTP request body (Hash or String)",
95
+ optional: true,
96
+ type: Hash
97
+ ),
98
+ FastlaneCore::ConfigItem.new(
99
+ key: :timeout,
100
+ env_name: "HTTP_REQUEST_TIMEOUT",
101
+ description: "Request timeout in seconds",
102
+ optional: true,
103
+ default_value: 30,
104
+ type: Integer
105
+ ),
106
+ FastlaneCore::ConfigItem.new(
107
+ key: :verbose,
108
+ env_name: "HTTP_REQUEST_VERBOSE",
109
+ description: "If true, prints response body to logs",
110
+ optional: true,
111
+ default_value: false,
112
+ type: Boolean
113
+ )
114
+ ]
115
+ end
116
+
117
+ def self.is_supported?(platform)
118
+ true
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,36 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+
5
+ module Fastlane
6
+ module Helper
7
+ class HttpRequestHelper
8
+ def self.perform_request(uri, method, headers, body, timeout)
9
+ http = Net::HTTP.new(uri.host, uri.port)
10
+ http.use_ssl = uri.scheme == 'https'
11
+ http.read_timeout = timeout
12
+
13
+ request_class = request_class_for(method)
14
+ request = request_class.new(uri.request_uri, headers)
15
+
16
+ if body
17
+ request.body = body.to_json
18
+ end
19
+
20
+ http.request(request)
21
+ end
22
+
23
+ def self.request_class_for(method)
24
+ case method
25
+ when 'GET' then Net::HTTP::Get
26
+ when 'POST' then Net::HTTP::Post
27
+ when 'PUT' then Net::HTTP::Put
28
+ when 'PATCH' then Net::HTTP::Patch
29
+ when 'DELETE' then Net::HTTP::Delete
30
+ else
31
+ raise ArgumentError, "Unsupported HTTP method: #{method}"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module HttpRequest
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/http_request/version'
2
+
3
+ module Fastlane
4
+ module HttpRequest
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::HttpRequest.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-http_request
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Angelo Cassano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-11-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - LICENSE
20
+ - README.md
21
+ - lib/fastlane/plugin/http_request.rb
22
+ - lib/fastlane/plugin/http_request/actions/http_request_action.rb
23
+ - lib/fastlane/plugin/http_request/helper/http_request_helper.rb
24
+ - lib/fastlane/plugin/http_request/version.rb
25
+ homepage: https://github.com/AngeloAvv/fastlane-plugin-http_request
26
+ licenses:
27
+ - MIT
28
+ metadata:
29
+ rubygems_mfa_required: 'true'
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '2.6'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.4.10
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Fastlane plugin to send http requests
49
+ test_files: []