wix-apps 0.0.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,47 @@
1
1
  require 'bundler/setup'
2
+ require 'json'
2
3
  Bundler.require(:default, :development)
3
4
 
4
5
  Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each {|f| require f}
5
6
 
6
- require 'rack/test'
7
+ require 'rack/test'
8
+
9
+ def encode_base64(payload)
10
+ Base64.urlsafe_encode64(payload).gsub('=', '')
11
+ end
12
+
13
+ def decode_base64(encoded_payload)
14
+ padded = encoded_payload
15
+ padded += ('=' * (4 - encoded_payload.length % 4)) if padded.length % 4 != 0
16
+
17
+ Base64.urlsafe_decode64(padded)
18
+ end
19
+
20
+ def decode(signed_instance)
21
+ signature, encoded_json = signed_instance.split('.', 2)
22
+ decode_base64(encoded_json)
23
+ end
24
+
25
+ def sign(payload)
26
+ sign_string JSON.dump(payload)
27
+ end
28
+
29
+ def sign_string(payload)
30
+ encoded_payload = encode_base64(payload)
31
+ digest = OpenSSL::Digest.new('sha256')
32
+ hmac_digest = OpenSSL::HMAC.digest(digest, SECRET_KEY, encoded_payload)
33
+ my_signature = Base64.urlsafe_encode64(hmac_digest).gsub('=', '')
34
+ "#{my_signature}.#{encoded_payload}"
35
+ end
36
+
37
+ def params_required
38
+ {
39
+ instanceId: '9f9c5c16-59c8-4708-8c25-855505daa954',
40
+ signDate: DateTime.now.rfc3339,
41
+ permissions: '',
42
+ ipAndPort: '123.123.123.123:1234',
43
+ vendorProductId: '',
44
+ aid: '12645948-59c8-4708-8c25-855505dac8ca',
45
+ siteOwnerId: '92771668-366f-4ec6-be21-b32c78e7b734'
46
+ }
47
+ end
@@ -2,24 +2,28 @@
2
2
  require File.expand_path('../lib/wix-apps/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Gregory Man"]
6
- gem.email = ["man.gregory@gmail.com"]
5
+ gem.name = 'wix-apps'
6
+ gem.version = Wix::Apps::VERSION
7
+ gem.authors = ['Gregory Man', 'Niklas Bichinger']
8
+ gem.email = %w(man.gregory@gmail.com niklas@bichinger.de)
7
9
  gem.description = %q{ Rack middleware for WixApps }
8
10
  gem.summary = %q{ Rack middleware for WixApps parameters parsing and validation }
9
- gem.homepage = "https://github.com/wix/wix-apps-ruby"
10
-
11
- gem.add_dependency 'multi_json'
12
- gem.add_dependency 'rack'
13
- gem.add_dependency 'jruby-openssl' if RUBY_PLATFORM == 'java'
14
-
15
- gem.add_development_dependency 'rake'
16
- gem.add_development_dependency "rspec"
17
- gem.add_development_dependency 'rack-test'
11
+ gem.homepage = 'https://github.com/wix/wix-apps-ruby'
12
+ gem.license = 'MIT'
18
13
 
14
+ gem.required_ruby_version = ">= 2.0.0"
19
15
  gem.files = `git ls-files`.split($\)
20
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
21
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
22
- gem.name = "wix-apps"
23
- gem.require_paths = ["lib"]
24
- gem.version = Wix::Apps::VERSION
18
+ gem.require_paths = ['lib']
19
+
20
+ gem.add_runtime_dependency 'multi_json', '~> 1.0'
21
+ gem.add_runtime_dependency 'rack', '< 2'
22
+ gem.add_runtime_dependency 'jruby-openssl' if RUBY_PLATFORM == 'java'
23
+
24
+ gem.add_development_dependency 'ruby_dep', '1.3.1'
25
+ gem.add_development_dependency 'listen', '< 3.1.0'
26
+ gem.add_development_dependency 'rake', '>= 10', '~> 11'
27
+ gem.add_development_dependency 'rspec', '~> 3.0'
28
+ gem.add_development_dependency 'rack-test', '~> 0.6.2'
25
29
  end
metadata CHANGED
@@ -1,106 +1,132 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wix-apps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Gregory Man
8
+ - Niklas Bichinger
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-29 00:00:00.000000000 Z
12
+ date: 2016-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ~>
20
19
  - !ruby/object:Gem::Version
21
- version: '0'
20
+ version: '1.0'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - ~>
28
26
  - !ruby/object:Gem::Version
29
- version: '0'
27
+ version: '1.0'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: rack
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - <
36
33
  - !ruby/object:Gem::Version
37
- version: '0'
34
+ version: '2'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - <
44
40
  - !ruby/object:Gem::Version
45
- version: '0'
41
+ version: '2'
42
+ - !ruby/object:Gem::Dependency
43
+ name: ruby_dep
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.3.1
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.3.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: listen
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - <
61
+ - !ruby/object:Gem::Version
62
+ version: 3.1.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - <
68
+ - !ruby/object:Gem::Version
69
+ version: 3.1.0
46
70
  - !ruby/object:Gem::Dependency
47
71
  name: rake
48
72
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
73
  requirements:
51
- - - ! '>='
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '10'
77
+ - - ~>
52
78
  - !ruby/object:Gem::Version
53
- version: '0'
79
+ version: '11'
54
80
  type: :development
55
81
  prerelease: false
56
82
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
83
  requirements:
59
- - - ! '>='
84
+ - - '>='
60
85
  - !ruby/object:Gem::Version
61
- version: '0'
86
+ version: '10'
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '11'
62
90
  - !ruby/object:Gem::Dependency
63
91
  name: rspec
64
92
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
93
  requirements:
67
- - - ! '>='
94
+ - - ~>
68
95
  - !ruby/object:Gem::Version
69
- version: '0'
96
+ version: '3.0'
70
97
  type: :development
71
98
  prerelease: false
72
99
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
100
  requirements:
75
- - - ! '>='
101
+ - - ~>
76
102
  - !ruby/object:Gem::Version
77
- version: '0'
103
+ version: '3.0'
78
104
  - !ruby/object:Gem::Dependency
79
105
  name: rack-test
80
106
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
107
  requirements:
83
- - - ! '>='
108
+ - - ~>
84
109
  - !ruby/object:Gem::Version
85
- version: '0'
110
+ version: 0.6.2
86
111
  type: :development
87
112
  prerelease: false
88
113
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
114
  requirements:
91
- - - ! '>='
115
+ - - ~>
92
116
  - !ruby/object:Gem::Version
93
- version: '0'
94
- description: ! ' Rack middleware for WixApps '
117
+ version: 0.6.2
118
+ description: ' Rack middleware for WixApps '
95
119
  email:
96
120
  - man.gregory@gmail.com
121
+ - niklas@bichinger.de
97
122
  executables: []
98
123
  extensions: []
99
124
  extra_rdoc_files: []
100
125
  files:
101
126
  - .gitignore
102
127
  - .rspec
103
- - .rvmrc
128
+ - .ruby-gemset
129
+ - .ruby-version
104
130
  - .travis.yml
105
131
  - Gemfile
106
132
  - Guardfile
@@ -117,34 +143,28 @@ files:
117
143
  - spec/support/config.rb
118
144
  - wix-apps.gemspec
119
145
  homepage: https://github.com/wix/wix-apps-ruby
120
- licenses: []
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
121
149
  post_install_message:
122
150
  rdoc_options: []
123
151
  require_paths:
124
152
  - lib
125
153
  required_ruby_version: !ruby/object:Gem::Requirement
126
- none: false
127
154
  requirements:
128
- - - ! '>='
155
+ - - '>='
129
156
  - !ruby/object:Gem::Version
130
- version: '0'
131
- segments:
132
- - 0
133
- hash: 1603105339168113252
157
+ version: 2.0.0
134
158
  required_rubygems_version: !ruby/object:Gem::Requirement
135
- none: false
136
159
  requirements:
137
- - - ! '>='
160
+ - - '>='
138
161
  - !ruby/object:Gem::Version
139
162
  version: '0'
140
- segments:
141
- - 0
142
- hash: 1603105339168113252
143
163
  requirements: []
144
164
  rubyforge_project:
145
- rubygems_version: 1.8.24
165
+ rubygems_version: 2.4.8
146
166
  signing_key:
147
- specification_version: 3
167
+ specification_version: 4
148
168
  summary: Rack middleware for WixApps parameters parsing and validation
149
169
  test_files:
150
170
  - spec/lib/wix-apps/signed_instance_middleware_spec.rb
data/.rvmrc DELETED
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p194@wix-apps"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.13.4 (master)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- if [[ $- == *i* ]] # check for interactive shells
29
- then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
30
- else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
31
- fi
32
- else
33
- # If the environment file has not yet been created, use the RVM CLI to select.
34
- rvm --create use "$environment_id" || {
35
- echo "Failed to create RVM environment '${environment_id}'."
36
- return 1
37
- }
38
- fi
39
-
40
- # If you use bundler, this might be useful to you:
41
- # if [[ -s Gemfile ]] && {
42
- # ! builtin command -v bundle >/dev/null ||
43
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
44
- # }
45
- # then
46
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
47
- # gem install bundler
48
- # fi
49
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
50
- # then
51
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
52
- # fi