Class: Fastlane::Actions::IftttAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::IftttAction
- Defined in:
- fastlane/lib/fastlane/actions/ifttt.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
75 76 77 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 75 def self. ["vpolouchkine"] end |
.available_options ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 38 def self. [ FastlaneCore::ConfigItem.new(key: :api_key, env_name: "IFTTT_API_KEY", sensitive: true, description: "API key", verify_block: proc do |value| raise UI.error("No API key given, pass using `api_key: 'key'`") if value.to_s.empty? end), FastlaneCore::ConfigItem.new(key: :event_name, env_name: "IFTTT_EVENT_NAME", description: "The name of the event that will be triggered", verify_block: proc do |value| raise UI.error("No event name given, pass using `event_name: 'name'`") if value.to_s.empty? end), FastlaneCore::ConfigItem.new(key: :value1, env_name: "IFTTT_VALUE1", description: "Extra data sent with the event", optional: true, is_string: true), FastlaneCore::ConfigItem.new(key: :value2, env_name: "IFTTT_VALUE2", description: "Extra data sent with the event", optional: true, is_string: true), FastlaneCore::ConfigItem.new(key: :value3, env_name: "IFTTT_VALUE3", description: "Extra data sent with the event", optional: true, is_string: true) ] end |
.category ⇒ Object
91 92 93 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 91 def self.category :notifications end |
.description ⇒ Object
30 31 32 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 30 def self.description "Connect to the [IFTTT Maker Channel](https://ifttt.com/maker)" end |
.details ⇒ Object
34 35 36 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 34 def self.details "Connect to the IFTTT [Maker Channel](https://ifttt.com/maker). An IFTTT Recipe has two components: a Trigger and an Action. In this case, the Trigger will fire every time the Maker Channel receives a web request (made by this _fastlane_ action) to notify it of an event. The Action can be anything that IFTTT supports: email, SMS, etc." end |
.example_code ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 79 def self.example_code [ 'ifttt( api_key: "...", event_name: "...", value1: "foo", value2: "bar", value3: "baz" )' ] end |
.is_supported?(platform) ⇒ Boolean
71 72 73 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 71 def self.is_supported?(platform) true end |
.run(options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'fastlane/lib/fastlane/actions/ifttt.rb', line 4 def self.run() require "net/http" require "uri" uri = URI.parse("https://maker.ifttt.com/trigger/#{[:event_name]}/with/key/#{[:api_key]}") https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true req = Net::HTTP::Post.new(uri.request_uri) req.set_form_data({ "value1" => [:value1], "value2" => [:value2], "value3" => [:value3] }) response = https.request(req) UI.user_error!("Failed to make a request to IFTTT. #{response.}.") unless response.code == "200" UI.success("Successfully made a request to IFTTT.") end |