versacommerce_api 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab063131eca06a33652084d3c600a5969dfb96d0
4
- data.tar.gz: 2a041ef35d5c8862dde36251e509406836612477
3
+ metadata.gz: ffea06e1f2286dc324d82b8c2aaec2888de0e287
4
+ data.tar.gz: f8dbbdf494c8ce9b5719ccf09dca4ad0a90578fa
5
5
  SHA512:
6
- metadata.gz: b2dc87f6cb24352a11fb5d80a09b65f3beeac7808148713ba2750cafc25b7354516b63b0c152007359432dd3c1f05d7ba6dfe936508bdef45758fdafc7d64284
7
- data.tar.gz: 855669f52f66ea8f03d03394e960fe7e612237870264801e9544528ccde09c36363da49acb8fda9d4723990ef6fc188944e710ec920293829c22d212eeaeeec4
6
+ metadata.gz: 431a86486ed7cdd8ef2da0ac544fa9dd3212814205f056cf0a60fcb00b68d71616ab676b50d9491e52c138ebc57ec0c69a5b7f813245cd3e071d5bb614484f0b
7
+ data.tar.gz: 48926e482d27b2a4a12fae8952353ba5c4358437c20742426bba4407352b493775649300d8c344318dfab10db4be5358d1e9d42d44bfe2f78491fd6ef28f323c
@@ -5,7 +5,7 @@ require 'abbrev'
5
5
  module VersacommerceAPI
6
6
  class Cli < Thor
7
7
  include Thor::Actions
8
-
8
+
9
9
  class ConfigFileError < StandardError
10
10
  end
11
11
 
@@ -16,18 +16,18 @@ module VersacommerceAPI
16
16
  puts prefix + c
17
17
  end
18
18
  end
19
-
19
+
20
20
  desc "add [CONNECTION]", "Create a config file for a connection named CONNECTION"
21
21
  def add(connection)
22
22
  file = config_file(connection)
23
23
  if File.exist?(file)
24
24
  raise ConfigFileError, "There is already a config file at #{file}"
25
25
  else
26
- config = {'protocol' => 'http'}
26
+ config = {'protocol' => 'https'}
27
27
  config['domain'] = ask("Domain (leave blank for #{connection}.versacommerce.de):")
28
28
  config['domain'] = "#{connection}.versacommerce.de" if config['domain'].blank?
29
29
  config['domain'] = "#{config['domain']}.versacommerce.de" unless config['domain'].match(/[.:]/)
30
- puts "\nopen http://#{config['domain']}/admin/settings/apps in your browser to get API credentials\n"
30
+ puts "\nopen https://#{config['domain']}/admin/settings/apps in your browser to get API credentials\n"
31
31
  config['api_key'] = ask("API key :")
32
32
  config['password'] = ask("Password:")
33
33
  create_file(file, config.to_yaml)
@@ -36,7 +36,7 @@ module VersacommerceAPI
36
36
  default(connection)
37
37
  end
38
38
  end
39
-
39
+
40
40
  desc "remove [CONNECTION]", "Remove the config file for CONNECTION"
41
41
  def remove(connection)
42
42
  file = config_file(connection)
@@ -47,7 +47,7 @@ module VersacommerceAPI
47
47
  config_file_not_found_error(file)
48
48
  end
49
49
  end
50
-
50
+
51
51
  desc "edit [CONNECTION]", "Open the config file for CONNECTION with your default editor"
52
52
  def edit(connection=nil)
53
53
  file = config_file(connection)
@@ -61,7 +61,7 @@ module VersacommerceAPI
61
61
  config_file_not_found_error(file)
62
62
  end
63
63
  end
64
-
64
+
65
65
  desc "show [CONNECTION]", "Show the location and contents of the CONNECTION's config file"
66
66
  def show(connection=nil)
67
67
  connection ||= default_connection
@@ -73,7 +73,7 @@ module VersacommerceAPI
73
73
  config_file_not_found_error(file)
74
74
  end
75
75
  end
76
-
76
+
77
77
  desc "default [CONNECTION]", "Show or set the default connection"
78
78
  def default(connection=nil)
79
79
  if connection
@@ -91,17 +91,17 @@ module VersacommerceAPI
91
91
  puts "There is no default connection set"
92
92
  end
93
93
  end
94
-
94
+
95
95
  desc "console [CONNECTION]", "Startup an API console for CONNECTION"
96
96
  def console(connection=nil)
97
97
  file = config_file(connection)
98
-
98
+
99
99
  config = YAML.load(File.read(file))
100
100
  puts ""
101
101
  puts "--> Starting interactive API console for #{config['domain']} - #{file}"
102
102
  puts ""
103
103
  VersacommerceAPI::Base.site = site_from_config(config)
104
-
104
+
105
105
  require 'irb'
106
106
  require 'irb/completion'
107
107
  ARGV.clear
@@ -113,15 +113,15 @@ module VersacommerceAPI
113
113
  end
114
114
 
115
115
  private
116
-
116
+
117
117
  def shop_config_dir
118
118
  @shop_config_dir ||= File.join(ENV['HOME'], '.versacommerce', 'shops')
119
119
  end
120
-
120
+
121
121
  def default_symlink
122
122
  @default_symlink ||= File.join(shop_config_dir, 'default')
123
123
  end
124
-
124
+
125
125
  def config_file(connection)
126
126
  if connection
127
127
  File.join(shop_config_dir, "#{connection}.yml")
@@ -129,35 +129,35 @@ module VersacommerceAPI
129
129
  default_symlink
130
130
  end
131
131
  end
132
-
132
+
133
133
  def site_from_config(config)
134
134
  protocol = config['protocol'] || 'https'
135
135
  api_key = config['api_key']
136
136
  password = config['password']
137
137
  domain = config['domain']
138
-
138
+
139
139
  VersacommerceAPI::Base.site = "#{protocol}://#{api_key}:#{password}@#{domain}/api"
140
140
  end
141
-
141
+
142
142
  def available_connections
143
143
  @available_connections ||= begin
144
144
  pattern = File.join(shop_config_dir, "*.yml")
145
145
  Dir.glob(pattern).map { |f| File.basename(f, ".yml") }
146
146
  end
147
147
  end
148
-
148
+
149
149
  def default_connection_target
150
150
  @default_connection_target ||= File.readlink(default_symlink)
151
151
  end
152
-
152
+
153
153
  def default_connection
154
154
  @default_connection ||= File.basename(default_connection_target, ".yml")
155
155
  end
156
-
156
+
157
157
  def default?(connection)
158
158
  default_connection == connection
159
159
  end
160
-
160
+
161
161
  def config_file_not_found_error(filename)
162
162
  raise ConfigFileError, "Could not find config file at #{filename}"
163
163
  end
@@ -1,8 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module VersacommerceAPI
3
-
3
+
4
4
  class ProductImage < Base
5
-
5
+
6
6
  def initialize(attributes, persisted = false)
7
7
  super
8
8
  if self.attributes['file']
@@ -15,54 +15,54 @@ module VersacommerceAPI
15
15
  self.attributes.delete 'file'
16
16
  end
17
17
  end
18
-
18
+
19
19
  def pico
20
20
  generate_resized_url(original, :resize, '16x16')
21
21
  end
22
-
22
+
23
23
  def icon
24
24
  generate_resized_url(original, :resize, '32x32')
25
25
  end
26
-
26
+
27
27
  def thumb
28
28
  generate_resized_url(original, :resize, '50x50')
29
29
  end
30
-
30
+
31
31
  def small
32
32
  generate_resized_url(original, :resize, '100x100')
33
33
  end
34
-
34
+
35
35
  def medium
36
36
  generate_resized_url(original, :resize, '240x240')
37
37
  end
38
-
38
+
39
39
  def large
40
40
  generate_resized_url(original, :resize, '480x480')
41
41
  end
42
-
42
+
43
43
  def xlarge
44
44
  generate_resized_url(original, :resize, '960x960')
45
45
  end
46
-
46
+
47
47
  def standard
48
48
  generate_resized_url(original, :resize, '1024x1024')
49
49
  end
50
-
50
+
51
51
  def original
52
- "http://images.versacommerce.net/++/#{src.gsub("http://", "")}"
52
+ "https://images.versacommerce.net/++/#{src.gsub("http://", "")}"
53
53
  end
54
-
54
+
55
55
  def upload_image(data, filename = nil)
56
56
  attributes['image_data'] = Base64.encode64(data)
57
57
  attributes['filename'] = filename unless filename.nil?
58
58
  end
59
-
59
+
60
60
  private
61
-
61
+
62
62
  def generate_resized_url(url, command, value)
63
63
  refit_url = url.gsub("\/++\/", "\/#{command}=#{value}\/++\/")
64
64
  end
65
-
65
+
66
66
  end
67
67
 
68
68
  end
@@ -0,0 +1,7 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module VersacommerceAPI
3
+
4
+ class ProductListing < Base
5
+ end
6
+
7
+ end
@@ -46,7 +46,7 @@ module VersacommerceAPI
46
46
 
47
47
  def create_permission_url
48
48
  return nil if url.blank? || api_key.blank?
49
- "http://#{url}/api/auth?api_key=#{api_key}"
49
+ "https://#{url}/api/auth?api_key=#{api_key}"
50
50
  end
51
51
 
52
52
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module VersacommerceAPI
3
- VERSION = '1.0.16'
3
+ VERSION = '1.0.17'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versacommerce_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - VersaCommerce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-28 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -185,6 +185,7 @@ files:
185
185
  - lib/versacommerce_api/resources/payment_method.rb
186
186
  - lib/versacommerce_api/resources/product.rb
187
187
  - lib/versacommerce_api/resources/product_image.rb
188
+ - lib/versacommerce_api/resources/product_listing.rb
188
189
  - lib/versacommerce_api/resources/property.rb
189
190
  - lib/versacommerce_api/resources/shipment.rb
190
191
  - lib/versacommerce_api/resources/shipping_address.rb
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  version: '0'
217
218
  requirements: []
218
219
  rubyforge_project:
219
- rubygems_version: 2.4.5.1
220
+ rubygems_version: 2.6.11
220
221
  signing_key:
221
222
  specification_version: 4
222
223
  summary: The VersaCommerce API gem is a lightweight gem for accessing the VersaCommerce