bigcommerce 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -0
- data/lib/bigcommerce.rb +1 -1
- data/lib/bigcommerce/api.rb +21 -1
- data/lib/bigcommerce/connection.rb +28 -0
- metadata +3 -3
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
data/lib/bigcommerce/api.rb
CHANGED
@@ -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:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- BigCommerce
|