fastlane-plugin-giffy 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
+ SHA1:
3
+ metadata.gz: f1b5b1fee504462e7b1d9c03a6687fd90bbd5020
4
+ data.tar.gz: 4820a00831fe7c55ba2da8b4131ba16c631ff667
5
+ SHA512:
6
+ metadata.gz: 86c647229cb501455180da3a4b0d782a074fbb3a941bb2063da4ed1c9969912d993783bbd7b8addbf98758fc9166dbb39649597143c73e831952d5b3f108fd60
7
+ data.tar.gz: f1aeb6163f1bcb3d229d4bb3f93989283d9c528d0c8ff4ea97a0952749af5bb34f9d4036764a1017d44e40f39b2702bdf0f3654be3d5cbdc51659b1e4b9e6160
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Siarhei Fiedartsou <Sergei_Fedortsov@cedoni.com>
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,77 @@
1
+ # giffy plugin
2
+
3
+ [![CI Status](http://img.shields.io/travis/SiarheiFedartsou/fastlane-plugin-giffy.svg?style=flat)](https://travis-ci.org/SiarheiFedartsou/fastlane-plugin-giffy)
4
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-giffy)
5
+
6
+ ## Getting Started
7
+
8
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-giffy`, add it to your project by running:
9
+
10
+ ```bash
11
+ fastlane add_plugin giffy
12
+ ```
13
+
14
+ ## About giffy
15
+
16
+ Allows to add some more fun to your development process. Currently provides 2 actions:
17
+
18
+ ### giffy_random_gif_url
19
+
20
+ ```ruby
21
+ giffy_random_gif_url(
22
+ api_key: 'YOUR_GIFFY_API_KEY',
23
+ tag: 'cats',
24
+ original_gif: false # optional, default value is false
25
+ )
26
+ ```
27
+ ### giffy_random_sticker_url
28
+
29
+ ```ruby
30
+ giffy_random_sticker_url(
31
+ api_key: 'YOUR_GIFFY_API_KEY',
32
+ tag: 'cats',
33
+ original_gif: false # optional, default value is false
34
+ )
35
+ ```
36
+
37
+ ## Example
38
+
39
+ Like a the simplest example, you can add random fun GIF to your Slack notification:
40
+
41
+ ```
42
+ slack(message: "Application is successfully released to the App Store.",
43
+ channel: "#releases",
44
+ success: true,
45
+ attachment_properties: {
46
+ image_url: giffy_random_gif_url(tag: 'release', api_key: 'dc6zaTOxFJmzC')
47
+ })
48
+ ```
49
+
50
+ ## Run tests for this plugin
51
+
52
+ To run both the tests, and code style validation, run
53
+
54
+ ```
55
+ rake
56
+ ```
57
+
58
+ To automatically fix many of the styling issues, use
59
+ ```
60
+ rubocop -a
61
+ ```
62
+
63
+ ## Issues and Feedback
64
+
65
+ For any other issues and feedback about this plugin, please submit it to this repository.
66
+
67
+ ## Troubleshooting
68
+
69
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
70
+
71
+ ## Using `fastlane` Plugins
72
+
73
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
74
+
75
+ ## About `fastlane`
76
+
77
+ `fastlane` is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/giffy/version'
2
+
3
+ module Fastlane
4
+ module Giffy
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::Giffy.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,41 @@
1
+ module Fastlane
2
+ module Actions
3
+ class GiffyRandomGifUrlAction < Action
4
+ def self.run(params)
5
+ return Helper::GiffyHelper.get_random_gif_url('gifs', params)
6
+ end
7
+
8
+ def self.description
9
+ "Allows to obtain URL to some random funny GIF from Giffy.com"
10
+ end
11
+
12
+ def self.authors
13
+ ["SiarheiFiedartsou"]
14
+ end
15
+
16
+ def self.available_options
17
+ [
18
+ FastlaneCore::ConfigItem.new(key: :api_key,
19
+ env_name: "GIFFY_API_KEY",
20
+ description: "API key for Giffy API",
21
+ optional: false,
22
+ type: String),
23
+ FastlaneCore::ConfigItem.new(key: :original_gif,
24
+ description: "If true returns URL to not downsampled GIF with much larger size",
25
+ default_value: false,
26
+ optional: true,
27
+ type: String),
28
+ FastlaneCore::ConfigItem.new(key: :tag,
29
+ description: "Tag by which GIFs will be searched",
30
+ optional: false,
31
+ type: String)
32
+
33
+ ]
34
+ end
35
+
36
+ def self.is_supported?(platform)
37
+ true
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ module Fastlane
2
+ module Actions
3
+ class GiffyRandomStickerUrlAction < Action
4
+ def self.run(params)
5
+ return Helper::GiffyHelper.get_random_gif_url('stickers', params)
6
+ end
7
+
8
+ def self.description
9
+ "Allows to obtain URL to some random GIF sticker from Giffy.com"
10
+ end
11
+
12
+ def self.authors
13
+ ["SiarheiFiedartsou"]
14
+ end
15
+
16
+ def self.available_options
17
+ [
18
+ FastlaneCore::ConfigItem.new(key: :api_key,
19
+ env_name: "GIFFY_API_KEY",
20
+ description: "API key for Giffy API",
21
+ optional: false,
22
+ type: String),
23
+ FastlaneCore::ConfigItem.new(key: :original_gif,
24
+ description: "If true returns URL to not downsampled GIF with much larger size",
25
+ default_value: false,
26
+ optional: true,
27
+ type: String),
28
+ FastlaneCore::ConfigItem.new(key: :tag,
29
+ description: "Tag by which GIFs will be searched",
30
+ optional: false,
31
+ type: String)
32
+
33
+ ]
34
+ end
35
+
36
+ def self.is_supported?(platform)
37
+ true
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,30 @@
1
+ module Fastlane
2
+ module Helper
3
+ class GiffyHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::GiffyHelper.your_method`
6
+ #
7
+
8
+
9
+ def self.get_random_gif_url(gifs_or_stickers, params)
10
+ require 'net/http'
11
+ require 'json'
12
+ begin
13
+ escaped_tag = URI.escape(params[:tag])
14
+ uri = URI("http://api.giphy.com/v1/#{gifs_or_stickers}/random?api_key=#{params[:api_key]}&tag=#{escaped_tag}")
15
+ json_body = Net::HTTP.get(uri)
16
+ json_hash = JSON.parse(json_body)
17
+
18
+ puts json_hash.to_s
19
+ if params[:original_gif]
20
+ return json_hash['data']['image_url']
21
+ else
22
+ return json_hash['data']['fixed_width_downsampled_url']
23
+ end
24
+ rescue
25
+ UI.error('Something went wrong...')
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Giffy
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-giffy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - SiarheiFiedartsou
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fastlane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.99.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.99.0
111
+ description:
112
+ email: siarhei.fedartsou@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/giffy.rb
120
+ - lib/fastlane/plugin/giffy/actions/giffy_random_gif_url_action.rb
121
+ - lib/fastlane/plugin/giffy/actions/giffy_random_sticker_url_action.rb
122
+ - lib/fastlane/plugin/giffy/helper/giffy_helper.rb
123
+ - lib/fastlane/plugin/giffy/version.rb
124
+ homepage: https://github.com/SiarheiFedartsou/fastlane-plugin-giffy
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.6.4
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: giffy
148
+ test_files: []