fastlane-plugin-sharethemeal 0.1.3 → 0.1.4.pre.alpha.pre.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +10 -11
- data/lib/fastlane/plugin/sharethemeal/actions/sharethemeal_action.rb +49 -49
- data/lib/fastlane/plugin/sharethemeal/version.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Y2QyYmY0ZTJhYTAzNGE1NmIyYTAzNGRkY2MyN2U2MjRjNDI0NTBiMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
N2M3ZDdhZTU3NGE3MWE2NWQyZDM1OTgyNGFiYWI0NjJiODAyMmZjYQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OWI2ODkwMGJhOTRkYzcwNTlhYWNlMDc1NThmODZjMWZiOTJlOGIzZDEzYTY3
|
10
|
+
MGExYmE3NTA0ZjA3NGU1ZjYxOGI0MDExYjM1NTEzNDNhNzEzMGJiNjQ0MTI1
|
11
|
+
YzQ0Y2UzMGI2YmRmMjVlNTM2YTBkYmViNDVhNDdhMjI4NjgzMjg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTE5ZGNlODNkM2Q3YzcxZTYwMDg3NzcwMTQwMDE1Mjc1OTcwYzBkNDE2MjUz
|
14
|
+
MzZiOTZlMDJlNzA1ZmJlOTRhNmUwYmU4OGE5OTk2NGM2NGJhY2E2N2ZlNTZj
|
15
|
+
MjA1NzFiMDMzZmI1NDU2MjQ0YWQ2NDAwMjI4OGEzMDg1OWYyMWM=
|
data/README.md
CHANGED
@@ -7,26 +7,25 @@
|
|
7
7
|
[fastlane](https://fastlane.tools) saves us hours of work, which eventually saves us a lot of money.
|
8
8
|
This is my way of reminding myself to give, on every deploy using [fastlane](https://fastlane.tools).
|
9
9
|
|
10
|
-
Opens a Browser with the Donation page of [ShareTheMeal](https://sharethemeal.org/)
|
11
|
-
to get the URL, please donate once per app - and copy the URL.
|
12
|
-
|
13
10
|
![Screenshot](screen.png)
|
14
11
|
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
*
|
21
|
-
*
|
22
|
-
|
13
|
+
## Setup
|
14
|
+
* Download the Share the meal app
|
15
|
+
* IOS: [AppStore](https://click.google-analytics.com/redirect?tid=UA-58737077-1&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fsharethemeal%2Fid977130010&aid=org.sharethemeal.app&idfa=%{idfa}&cs=stmwebsite&cm=website&cn=permanent)
|
16
|
+
* ANDROID: [PlayStore] (https://play.google.com/store/apps/details?id=org.sharethemeal.app&referrer=utm_source%3Dstmwebsite%26utm_medium%3Dwebsite%26utm_campaign%3Dpermanent)
|
17
|
+
* Donate Once, and store your payment settings (e.g: paypal)
|
18
|
+
* hit the donate button, on IOS it opens a browser, in the url find the `userHash`
|
19
|
+
* add the code below to your fastlane file/lane
|
23
20
|
|
24
21
|
## Example
|
25
22
|
|
26
23
|
```ruby
|
27
24
|
sharethemeal(
|
28
25
|
amount: "0.4",
|
29
|
-
|
26
|
+
userhash: "XXX",
|
27
|
+
currency: "EUR",
|
28
|
+
team_id: "coders_who_care"
|
30
29
|
)
|
31
30
|
```
|
32
31
|
|
@@ -1,88 +1,88 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'rest-client'
|
2
|
+
require 'base64'
|
3
|
+
require 'json'
|
4
|
+
require 'uri'
|
5
5
|
module Fastlane
|
6
6
|
module Actions
|
7
7
|
class SharethemealAction < Action
|
8
8
|
def self.run(params)
|
9
|
-
|
10
|
-
url_parsed = URI.parse(params[:url])
|
11
|
-
stm_options = URI.decode_www_form(url_parsed.query).to_h
|
12
|
-
|
13
|
-
begin
|
14
|
-
bearer = "LAXQszxcmpGMWi24y0NFt00YPWGJnJOo9Ba8ijLcI1fmiKHI1PDF7KG7PGJU7KcX"
|
9
|
+
bearer = 'LAXQszxcmpGMWi24y0NFt00YPWGJnJOo9Ba8ijLcI1fmiKHI1PDF7KG7PGJU7KcX'
|
15
10
|
token_payload = {
|
16
|
-
|
17
|
-
|
11
|
+
'userHash' => params[:userhash],
|
12
|
+
'currency' => params[:currency]
|
18
13
|
}
|
19
14
|
|
20
|
-
client_token = RestClient.post(
|
21
|
-
|
22
|
-
|
23
|
-
Authorization: "Bearer #{bearer}"
|
24
|
-
})
|
15
|
+
client_token = RestClient.post('https://api.sharethemeal.org/api/payment/braintree/client-tokens', token_payload.to_json,
|
16
|
+
content_type: :json, accept: :json,
|
17
|
+
Authorization: "Bearer #{bearer}")
|
25
18
|
|
26
19
|
client_token_response = JSON.parse(client_token)
|
27
20
|
|
28
|
-
auth_reply = JSON.parse(Base64.decode64(client_token_response[
|
29
|
-
finger_print = URI.encode_www_form_component(auth_reply[
|
21
|
+
auth_reply = JSON.parse(Base64.decode64(client_token_response['clientToken']))
|
22
|
+
finger_print = URI.encode_www_form_component(auth_reply['authorizationFingerprint'])
|
30
23
|
|
31
|
-
payment_infos = RestClient.get("https://api.braintreegateway.com/merchants/
|
24
|
+
payment_infos = RestClient.get("https://api.braintreegateway.com/merchants/#{auth_reply['merchantId']}/client_api/v1/payment_methods?sharedCustomerIdentifierType=undefined&braintreeLibraryVersion=braintree%2Fweb%2F2.15.5&merchantAccountId=#{auth_reply['merchantAccountId']}&authorizationFingerprint=#{finger_print}&callback=")
|
32
25
|
payment_infos_json = JSON.parse(payment_infos)
|
33
26
|
|
34
27
|
transaction_payload = {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"thankYouUri" => stm_options["thankYouUri"]
|
42
|
-
}
|
28
|
+
'userHash' => params[:userhash],
|
29
|
+
'amount' => params[:amount],
|
30
|
+
'currency' => params[:currency],
|
31
|
+
'paymentMethodNonce' => payment_infos_json['paymentMethods'].first['nonce'],
|
32
|
+
'teamId' => params[:team_id]
|
33
|
+
}
|
43
34
|
|
44
|
-
transaction_response = RestClient.post('https://api.sharethemeal.org/api/payment/braintree/transactions', transaction_payload.to_json,
|
45
|
-
|
46
|
-
"Authorization" => "Bearer #{bearer}"
|
47
|
-
})
|
35
|
+
transaction_response = RestClient.post('https://api.sharethemeal.org/api/payment/braintree/transactions', transaction_payload.to_json, content_type: :json, accept: :json,
|
36
|
+
'Authorization' => "Bearer #{bearer}")
|
48
37
|
|
49
38
|
transaction_response_json = JSON.parse(transaction_response)
|
50
|
-
if transaction_response_json[
|
51
|
-
UI.success "Successfully Donated #{params[:amount]} to ShareTheMeal 🍔 "
|
39
|
+
if transaction_response_json['result']['donationCreated'] == true
|
40
|
+
UI.success "Successfully Donated #{params[:amount]} #{params[:currency]} to ShareTheMeal 🍔 "
|
52
41
|
else
|
53
|
-
UI.warning
|
42
|
+
UI.warning 'Donation was not successfully accepted, maybe card is invalid or something else'
|
54
43
|
end
|
55
44
|
|
56
45
|
rescue => err
|
57
|
-
UI.error "Donation failed, be sure that you have done atleast one manual donation with a stored payment option"
|
58
|
-
end
|
46
|
+
UI.error "Donation failed, be sure that you have done atleast one manual donation with a stored payment option: #{err}"
|
59
47
|
end
|
60
48
|
|
61
49
|
def self.description
|
62
|
-
|
50
|
+
'Donate ShareTheMeal'
|
63
51
|
end
|
64
52
|
|
65
53
|
def self.authors
|
66
|
-
[
|
54
|
+
['hjanuschka']
|
67
55
|
end
|
68
56
|
|
69
57
|
def self.available_options
|
70
58
|
[
|
71
|
-
FastlaneCore::ConfigItem.new(key: :
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
59
|
+
FastlaneCore::ConfigItem.new(key: :userhash,
|
60
|
+
env_name: 'SHARETHEMEAL_USERHASH',
|
61
|
+
description: 'ShareTheMeal USERHASH',
|
62
|
+
optional: false,
|
63
|
+
type: String),
|
76
64
|
FastlaneCore::ConfigItem.new(key: :amount,
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
65
|
+
env_name: 'SHARETHEMEAL_AMOUNT',
|
66
|
+
description: 'ShareTheMeal Amount',
|
67
|
+
optional: false,
|
68
|
+
type: String),
|
69
|
+
FastlaneCore::ConfigItem.new(key: :currency,
|
70
|
+
env_name: 'SHARETHEMEAL_CURRENCY',
|
71
|
+
description: 'ShareTheMeal Currency',
|
72
|
+
default_value: 'EUR',
|
73
|
+
optional: false,
|
74
|
+
type: String),
|
75
|
+
FastlaneCore::ConfigItem.new(key: :team_id,
|
76
|
+
env_name: 'SHARETHEMEAL_TEAM_ID',
|
77
|
+
description: 'ShareTheMeal Team ID',
|
78
|
+
default_value: 'fastlane',
|
79
|
+
optional: false,
|
80
|
+
type: String)
|
81
81
|
|
82
82
|
]
|
83
83
|
end
|
84
84
|
|
85
|
-
def self.is_supported?(
|
85
|
+
def self.is_supported?(_platform)
|
86
86
|
true
|
87
87
|
end
|
88
88
|
end
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-sharethemeal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4.pre.alpha.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Helmut Januschka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: fastlane
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 1.104.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 1.104.0
|
111
111
|
description:
|
@@ -130,17 +130,17 @@ require_paths:
|
|
130
130
|
- lib
|
131
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- -
|
133
|
+
- - ! '>='
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - ! '>'
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: 1.3.1
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.4.
|
143
|
+
rubygems_version: 2.4.5
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: ShareTheMeal
|