bigcommerce 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,12 @@ BigCommerce API V2 - Ruby Client
4
4
  This library provides a wrapper around the BigCommerce REST API for use within
5
5
  Ruby apps or via the console.
6
6
 
7
+ Note
8
+ ----
9
+
10
+ **The Ruby Client is still in alpha and core features of the API may be
11
+ unsupported and undocumented.**
12
+
7
13
  Requirements
8
14
  ------------
9
15
 
data/lib/bigcommerce.rb CHANGED
@@ -9,5 +9,5 @@ require File.join(File.dirname(__FILE__), 'bigcommerce', 'api')
9
9
  require File.join(File.dirname(__FILE__), 'bigcommerce', 'connection')
10
10
 
11
11
  module BigCommerce
12
- VERSION = "0.0.4"
12
+ VERSION = "0.0.5"
13
13
  end
@@ -1,9 +1,29 @@
1
1
  module BigCommerce
2
2
  class Api
3
3
 
4
- def initialize(configuration)
4
+ def initialize(configuration={})
5
5
  @connection = Connection.new(configuration)
6
6
  end
7
+
8
+ def store_url=(store_url)
9
+ @connection.store_url = store_url
10
+ end
11
+
12
+ def username=(username)
13
+ @connection.username = username
14
+ end
15
+
16
+ def api_key=(api_key)
17
+ @connection.api_key = api_key
18
+ end
19
+
20
+ def verify_peer=(verify)
21
+ @connection.verify_peer = verify
22
+ end
23
+
24
+ def ca_file=(path)
25
+ @connection.ca_file = path
26
+ end
7
27
 
8
28
  def get_time
9
29
  @connection.get '/time'
@@ -4,6 +4,26 @@ module BigCommerce
4
4
  def initialize(configuration)
5
5
  @configuration = configuration
6
6
  end
7
+
8
+ def store_url=(store_url)
9
+ @configuration[:store_url] = store_url
10
+ end
11
+
12
+ def username=(username)
13
+ @configuration[:username] = username
14
+ end
15
+
16
+ def api_key=(api_key)
17
+ @configuration[:api_key] = api_key
18
+ end
19
+
20
+ def verify_peer=(verify)
21
+ @configuration[:verify_peer] = verify
22
+ end
23
+
24
+ def ca_file=(path)
25
+ @configuration.ca_file = path
26
+ end
7
27
 
8
28
  def get(path)
9
29
  request(:get, path)
@@ -29,6 +49,14 @@ module BigCommerce
29
49
 
30
50
  http = Net::HTTP.new(uri.host, uri.port)
31
51
  http.use_ssl = true
52
+
53
+ if @configuration.has_key?(:verify_peer) && @configuration[:verify_peer]
54
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
55
+ else
56
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
57
+ end
58
+
59
+ http.ca_file = @configuration[:ca_path] if @configuration.has_key?(:ca_path)
32
60
 
33
61
  request = case method
34
62
  when :get then Net::HTTP::Get.new(uri.request_uri)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigcommerce
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - BigCommerce