bigcommerce 0.8.0 → 0.8.1

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 CHANGED
@@ -49,7 +49,7 @@ follows:
49
49
  ```
50
50
  require 'bigcommerce'
51
51
 
52
- api = BigCommerce::Api.new({
52
+ api = Bigcommerce::Api.new({
53
53
  :store_url => "https://store.mybigcommerce.com",
54
54
  :username => "admin",
55
55
  :api_key => "d81aada4c19c34d913e18f07fd7f36ca"
@@ -60,7 +60,7 @@ If you want to enable SSL certificates -
60
60
 
61
61
  ```
62
62
  require 'bigcommerce'
63
- api = BigCommerce::Api.new({
63
+ api = Bigcommerce::Api.new({
64
64
  :store_url => "https://store.mybigcommerce.com",
65
65
  :username => "admin",
66
66
  :api_key => "d81aada4c19c34d913e18f07fd7f36ca"
@@ -113,7 +113,7 @@ module Bigcommerce
113
113
  @connection.get("/options/#{id}",{})
114
114
  end
115
115
 
116
- def create_options(options={})
116
+ def create_option(options={})
117
117
  @connection.post("/options", options)
118
118
  end
119
119
 
@@ -145,11 +145,11 @@ module Bigcommerce
145
145
  @connection.get("/optionsets/#{id}", {})
146
146
  end
147
147
 
148
- def create_optionsets(options={})
148
+ def create_optionset(options={})
149
149
  @connection.post("/optionsets", options)
150
150
  end
151
151
 
152
- def update_optionset(id,options={})
152
+ def update_optionset(id, options={})
153
153
  @connection.put("/optionsets/#{id}", options)
154
154
  end
155
155
 
@@ -161,12 +161,12 @@ module Bigcommerce
161
161
  @connection.get("/optionsets/options/#{id}", {})
162
162
  end
163
163
 
164
- def create_optionsets_options(options={})
165
- @connection.post("/optionsets/options", options)
164
+ def create_optionset_option(id, options={})
165
+ @connection.post("/optionsets/#{id}/options", options)
166
166
  end
167
167
 
168
- def update_optionsets_option(id,options={})
169
- @connection.put("/optionsets/options/#{id}", options)
168
+ def update_optionset_option(optionset_id, option_id, options={})
169
+ @connection.put("/optionsets/#{optionset_id}/options/#{option_id}", options)
170
170
  end
171
171
 
172
172
  def get_orders(options={})
@@ -237,7 +237,7 @@ module Bigcommerce
237
237
  @connection.get("/orderstatuses", options)
238
238
  end
239
239
 
240
- def get_orderstatuses(id)
240
+ def get_orderstatus(id)
241
241
  @connection.get("/orderstatuses/#{id}", {})
242
242
  end
243
243
 
@@ -321,7 +321,6 @@ module Bigcommerce
321
321
  @connection.put("/products/#{product_id}/rules/#{rule_id}", options)
322
322
  end
323
323
 
324
- #products/skus
325
324
  def get_products_skus(options={})
326
325
  @connection.get("/products/skus", options)
327
326
  end
@@ -2,11 +2,19 @@ module Bigcommerce
2
2
  class Connection
3
3
 
4
4
  def initialize(configuration)
5
- @configuration = configuration
5
+ @configuration = {}
6
+ configuration.each do |key, val|
7
+ send(key.to_s + "=", val)
8
+ end
9
+ end
10
+
11
+ def configuration
12
+ @configuration
6
13
  end
7
14
 
8
15
  def store_url=(store_url)
9
- @configuration[:store_url] = store_url
16
+ url = URI.parse(store_url)
17
+ @configuration[:store_url] = url.scheme + "://" + url.host
10
18
  end
11
19
 
12
20
  def username=(username)
@@ -79,7 +87,7 @@ module Bigcommerce
79
87
  end
80
88
  JSON.parse response
81
89
  rescue => e
82
- {"error"=>"Nothing to parse. Possibly no data?"}.to_json
90
+ raise "Failed to parse Bigcommerce response: #{e}"
83
91
  end
84
92
  end
85
93
 
@@ -1,6 +1,6 @@
1
1
  module Bigcommerce
2
2
  major = 0
3
3
  minor = 8
4
- patch = 0
4
+ patch = 1
5
5
  VERSION = [major, minor, patch].join('.') unless defined? Bigcommerce::VERSION
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigcommerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-29 00:00:00.000000000 Z
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -180,10 +180,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  requirements: []
182
182
  rubyforge_project:
183
- rubygems_version: 1.8.23
183
+ rubygems_version: 1.8.24
184
184
  signing_key:
185
185
  specification_version: 3
186
186
  summary: Enables Ruby applications to communicate with the Bigcommerce API
187
187
  test_files:
188
188
  - spec/models/api_spec.rb
189
189
  - spec/models/connection_spec.rb
190
+ has_rdoc: false