versacommerce_api 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/versacommerce_api/session.rb +14 -14
- data/lib/versacommerce_api/version.rb +1 -1
- metadata +25 -25
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZTViZTk1NGE4ODRhYmMyYTBhMjIzMzUwZTAyNDBkOTQyZTEwNTFjMQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d7c3e997269b30e057e5a53619d7910e3b90779
|
4
|
+
data.tar.gz: feccdd0902f778eadc9f027eeaca237b45f6a37d
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YjY4ZTRkZDc2Y2NkMWJmMjY1MTQ1NjhiZmZhYWQxNjgxNDRkYmY2ZDQ5Yjg5
|
11
|
-
NGNjMTAxODI3MGUxYTUzM2U3OGMzNzNmNWFhZDg5YTYwNmMxZDM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OTM5ZWM2ZThlMjg0OGE0YjcwNzYzMjA1NThmNjhhM2Q5YjAzZGRiMGIzODNi
|
14
|
-
NWU2OTVhMDk3ZGJjNDk3NTgzYzk3ZDI3MDg3MjM1ZGYxZTMxZTU3N2RkNWNj
|
15
|
-
ZjI4ZjdlNTQ0OGY1ZDc5YzRhNTJlNzg2YzQ4ZTZlNTMwMzA2NjE=
|
6
|
+
metadata.gz: c6e5bd02dc3d95e83e7a6e3514c2e270206b16a042ec2e26d0fb23956f6bc4bc01ac7ffede564fa902becbf3812d52089e2e508c83c277ff77d1e88b5add6470
|
7
|
+
data.tar.gz: 2de1cd2e2ce6f57c081b090a7f0c26a89e899c9e828bac226eb44bce7140f056a34ce11ca694dc7102846eaa437b1b8d627adeea2c8cbd10b63ec3968d9e2bb4
|
@@ -5,23 +5,23 @@ module VersacommerceAPI
|
|
5
5
|
cattr_accessor :api_key
|
6
6
|
cattr_accessor :secret
|
7
7
|
cattr_accessor :protocol
|
8
|
-
self.protocol = '
|
8
|
+
self.protocol = 'https'
|
9
9
|
|
10
10
|
attr_accessor :url, :token, :name
|
11
|
-
|
11
|
+
|
12
12
|
|
13
13
|
def initialize(url, token = nil, params = nil)
|
14
14
|
self.url, self.token = url, token
|
15
|
-
|
15
|
+
|
16
16
|
if params && params[:signature]
|
17
17
|
unless self.class.validate_signature(params) && params[:timestamp].to_i > 24.hours.ago.utc.to_i
|
18
|
-
raise "Invalid Signature: Possible malicious login"
|
18
|
+
raise "Invalid Signature: Possible malicious login"
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
self.class.prepare_url(self.url)
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
|
26
26
|
def self.setup(params)
|
27
27
|
params.each { |k,value| send("#{k}=", value) }
|
@@ -42,7 +42,7 @@ module VersacommerceAPI
|
|
42
42
|
def shop
|
43
43
|
Shop.current
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
|
47
47
|
def create_permission_url
|
48
48
|
return nil if url.blank? || api_key.blank?
|
@@ -54,7 +54,7 @@ module VersacommerceAPI
|
|
54
54
|
def site
|
55
55
|
"#{protocol}://#{api_key}:#{computed_password}@#{url}/api/"
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
|
59
59
|
def valid?
|
60
60
|
url.present? && token.present?
|
@@ -62,22 +62,22 @@ module VersacommerceAPI
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
-
# The secret is computed by taking the shared_secret which we got when
|
66
|
-
# registring this third party application and concating the request_to it,
|
65
|
+
# The secret is computed by taking the shared_secret which we got when
|
66
|
+
# registring this third party application and concating the request_to it,
|
67
67
|
# and then calculating a MD5 hexdigest.
|
68
|
-
|
68
|
+
|
69
69
|
# secret = shared_key
|
70
70
|
# token was provided by registration
|
71
71
|
def computed_password
|
72
72
|
Digest::MD5.hexdigest(secret + token.to_s)
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def self.prepare_url(url)
|
76
76
|
return nil if url.blank?
|
77
77
|
url.gsub!(/https?:\/\//, '') # remove http:// or https://
|
78
78
|
url.concat(".versacommerce.de") unless url.include?('.') # extend url to versacommerce.de if no host is given
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
def self.validate_signature(params)
|
82
82
|
return false unless signature = params[:signature]
|
83
83
|
|
@@ -85,5 +85,5 @@ module VersacommerceAPI
|
|
85
85
|
Digest::MD5.hexdigest(secret + sorted_params) == signature
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
end
|
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versacommerce_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VersaCommerce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
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: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
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: rspec
|
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: pry
|
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: pry-nav
|
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: activeresource
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 3.2.14
|
90
90
|
type: :runtime
|
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: 3.2.14
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: thor
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.14.4
|
104
104
|
type: :runtime
|
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: 0.14.4
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mocha
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.9.8
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.9.8
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: fakeweb
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: The VersaCommerce API gem allows Ruby developers to programmatically
|
@@ -146,8 +146,8 @@ executables:
|
|
146
146
|
extensions: []
|
147
147
|
extra_rdoc_files: []
|
148
148
|
files:
|
149
|
-
- .gitignore
|
150
|
-
- .ruby-version
|
149
|
+
- ".gitignore"
|
150
|
+
- ".ruby-version"
|
151
151
|
- CHANGELOG
|
152
152
|
- CONTRIBUTORS
|
153
153
|
- Gemfile
|
@@ -206,17 +206,17 @@ require_paths:
|
|
206
206
|
- lib
|
207
207
|
required_ruby_version: !ruby/object:Gem::Requirement
|
208
208
|
requirements:
|
209
|
-
- -
|
209
|
+
- - ">="
|
210
210
|
- !ruby/object:Gem::Version
|
211
211
|
version: '0'
|
212
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
|
-
- -
|
214
|
+
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '0'
|
217
217
|
requirements: []
|
218
218
|
rubyforge_project:
|
219
|
-
rubygems_version: 2.
|
219
|
+
rubygems_version: 2.6.11
|
220
220
|
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: The VersaCommerce API gem is a lightweight gem for accessing the VersaCommerce
|