bigcommerce 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) BigCommerce, 2011.
1
+ Copyright (C) Bigcommerce, 2011.
2
2
  All rights reserved.
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -17,4 +17,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
17
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
18
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
19
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- THE SOFTWARE.
20
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,12 +1,19 @@
1
1
  Bigcommerce API V2 - Ruby Client
2
2
  ================================
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/bigcommerce-api-ruby.png)](https://rubygems.org/gems/bigcommerce-api-ruby)
5
+ [![Build Status](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby.png?branch=master)](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby)
6
+ [![Dependency Status](https://gemnasium.com/bigcommerce/bigcommerce-api-ruby.png?travis)](https://gemnasium.com/bigcommerce/bigcommerce-api-ruby)
7
+ [![Code Climate](https://codeclimate.com/github/bigcommerce/bigcommerce-api-ruby.png)](https://codeclimate.com/github/bigcommerce/bigcommerce-api-ruby)
8
+ [![Coverage Status](https://coveralls.io/repos/bigcommerce/bigcommerce-api-ruby/badge.png?branch=master)](https://coveralls.io/r/bigcommerce/bigcommerce-api-ruby?branch=master)
9
+
4
10
  This library provides a wrapper around the Bigcommerce REST API for use within
5
11
  Ruby apps or via the console.
6
12
 
7
13
  Note
8
14
  ----
9
- If you find anything that is missing or needs clean up, please feel free to fork it and submit a changes with your pull request.
15
+ If you find anything that is missing or needs clean up, please feel free to fork
16
+ it and submit a changes with your pull request.
10
17
 
11
18
  Requirements
12
19
  ------------
@@ -19,7 +26,7 @@ To connect to the API, you need the following credentials:
19
26
  - Username of an authorized admin user of the store
20
27
  - API key for the user
21
28
 
22
- A valid API key is required to authenticate requests. To grant API access for
29
+ A valid API key is required to authenticate requests. To grant API access for a
23
30
  user, go to Control Panel > Users > Edit User and make sure that the
24
31
  'Enable API access?' checkbox is ticked.
25
32
 
@@ -33,11 +40,13 @@ install the package directly from Rubygems:
33
40
  gem install bigcommerce
34
41
  ```
35
42
 
36
- Note - the current gem version is 1.0. The Rubygems version might be older. You can install the gem directly from this repo. If you are using rails, you can point your gemfile to this git repo directly or do a local install of the gem by -
43
+ Note that the RubyGems version of this gem might be outdated. You can install the
44
+ gem directly from this repo. If you are using Rails, you can point your Gemfile
45
+ to this git repo directly or do a local install of the gem by -
37
46
 
38
47
  ```
39
- gem build bigcommerce
40
- gem install bigcommerce-1.0.gem
48
+ rake build
49
+ gem install pkg/bigcommerce-*.gem
41
50
  ```
42
51
 
43
52
  Configuration
@@ -70,7 +79,8 @@ api = Bigcommerce::Api.new({
70
79
  :verify_ssl => OpenSSL::SSL::VERIFY_PEER
71
80
  })
72
81
  ```
73
- Remember that the fields :ssl_client_cert, :ssl_client_key, :ssl_ca_file and :verify_ssl are all requrired when enabling SSL certs.
82
+ Remember that the fields `:ssl_client_cert`, `:ssl_client_key`, `:ssl_ca_file`
83
+ and `:verify_ssl` are all required when enabling SSL certificates.
74
84
 
75
85
  Connecting to the store
76
86
  -----------------------
@@ -118,4 +128,3 @@ api.update_products(31,{:name => "marvel comics spiderman",:sku => "marvel-spide
118
128
  api.update_optionsets(13,{:name => "Marvel toys"})
119
129
 
120
130
  ```
121
-
data/Rakefile CHANGED
@@ -2,6 +2,8 @@ require 'bundler/gem_tasks'
2
2
  require 'ci/reporter/rake/rspec'
3
3
  require 'rspec/core/rake_task'
4
4
 
5
+ Bundler::GemHelper.install_tasks
6
+
5
7
  RSpec::Core::RakeTask.new(:spec) do |spec|
6
8
  spec.pattern = 'spec/**/*_spec.rb'
7
9
  end
@@ -2,19 +2,29 @@
2
2
  require File.expand_path('../lib/bigcommerce/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.add_dependency('activesupport')
5
+ if RUBY_VERSION < '1.9'
6
+ s.add_dependency('activesupport', '< 4.0')
7
+ else
8
+ s.add_dependency('activesupport')
9
+ end
6
10
  s.add_dependency('json')
7
11
  s.add_dependency('rest-client')
12
+ if RUBY_VERSION >= '1.9'
13
+ s.add_development_dependency("coveralls")
14
+ end
8
15
  s.add_development_dependency("ci_reporter")
9
- s.add_development_dependency("vcr")
10
- s.add_development_dependency("webmock", '1.9')
11
16
  s.add_development_dependency("mocha")
12
17
  s.add_development_dependency("rake")
13
18
  s.add_development_dependency("rspec", '~> 2.11')
14
- s.authors = ["Bigcommerce"]
19
+ s.add_development_dependency("vcr")
20
+ s.add_development_dependency("webmock", '1.9')
21
+ s.authors = ["Mark Rickerby", "Rob Howard", "Saranyan Vigraham", "Sasha Gerrand"]
15
22
  s.date = Time.now.strftime("%Y-%m-%d")
16
23
  s.description = "Enables Ruby applications to communicate with the Bigcommerce API V2."
17
- s.email = "dev-accounts@bigcommerce.com"
24
+ s.email = ["mark.rickerby@bigcommerce.com",
25
+ "rob.howard@bigcommerce.com",
26
+ "saranyan.vigraham@bigcommerce.com",
27
+ "sasha.gerrand@bigcommerce.com"]
18
28
  s.files = ["LICENSE", "Rakefile", "README.md", "bigcommerce.gemspec"] + Dir['./**/*.rb'] + Dir['./**/*.crt']
19
29
  s.has_rdoc = false
20
30
  s.homepage = "http://github.com/bigcommerce/bigcommerce-api-ruby"
@@ -1 +1 @@
1
- raise "'big_commerce' (BigCommerce::Api) is no longer supported. Please require 'bigcommerce' (Bigcommerce::Api)"
1
+ raise "'big_commerce' (BigCommerce::Api) is no longer supported. Please require 'bigcommerce' (Bigcommerce::Api)"
@@ -53,6 +53,18 @@ module Bigcommerce
53
53
  @connection.put("/brands/#{id}", options)
54
54
  end
55
55
 
56
+ def get_coupons(options={})
57
+ @connection.get("/coupons", options)
58
+ end
59
+
60
+ def create_coupons(options={})
61
+ @connection.post("/coupons", options)
62
+ end
63
+
64
+ def update_coupon(id, options={})
65
+ @connection.put("/coupons/#{id}", options)
66
+ end
67
+
56
68
  def get_categories(options={})
57
69
  @connection.get("/categories", options)
58
70
  end
@@ -196,7 +208,7 @@ module Bigcommerce
196
208
  @connection.get("/orders/#{id}/coupons", {})
197
209
  end
198
210
 
199
- def get_orders_product(order_id,coupon_id)
211
+ def get_orders_coupon(order_id,coupon_id)
200
212
  @connection.get("/orders/#{order_id}/coupons/#{coupon_id}", {})
201
213
  end
202
214
 
@@ -85,7 +85,11 @@ module Bigcommerce
85
85
  when :delete then
86
86
  restclient.delete
87
87
  end
88
- JSON.parse response
88
+ if(response.code == 200)
89
+ JSON.parse response
90
+ elsif response.code == 204
91
+ nil
92
+ end
89
93
  rescue => e
90
94
  raise "Failed to parse Bigcommerce response: #{e}"
91
95
  end
@@ -1,6 +1,6 @@
1
1
  module Bigcommerce
2
2
  major = 0
3
3
  minor = 8
4
- patch = 2
4
+ patch = 3
5
5
  VERSION = [major, minor, patch].join('.') unless defined? Bigcommerce::VERSION
6
6
  end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe "BigCommerce" do
4
+ describe "require 'big_commerce'" do
5
+ it "should raise exception when required" do
6
+ lambda { (require 'big_commerce').should raise(RuntimeError) }
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,10 @@
1
+ begin
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ rescue LoadError => e
5
+ raise e unless RUBY_VERSION < '1.9'
6
+ end
7
+
1
8
  require 'bigcommerce'
2
9
  require 'date'
3
10
  require 'vcr'
@@ -17,4 +24,4 @@ end
17
24
 
18
25
  RSpec.configure do |c|
19
26
  c.treat_symbols_as_metadata_keys_with_true_values = true
20
- end
27
+ end
@@ -1,10 +1,10 @@
1
1
  shared_context "mock api" do
2
2
  let :api do
3
- connection = mock(Bigcommerce::Connection)
3
+ connection = double(Bigcommerce::Connection)
4
4
  api = Bigcommerce::Api.new
5
5
  api.instance_eval do
6
6
  @connection = connection
7
7
  end
8
8
  api
9
9
  end
10
- end
10
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bigcommerce do
4
+ describe 'VERSION' do
5
+ it "should have a version number set" do
6
+ expect(Bigcommerce::VERSION).to_not be_nil
7
+ end
8
+
9
+ it "should use a semantic version format" do
10
+ expect(Bigcommerce::VERSION).to match(/\d+\.\d+\.\d+(rc\d?)?/)
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,15 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigcommerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Bigcommerce
8
+ - Mark Rickerby
9
+ - Rob Howard
10
+ - Saranyan Vigraham
11
+ - Sasha Gerrand
9
12
  autorequire:
10
13
  bindir: bin
11
14
  cert_chain: []
12
- date: 2013-04-22 00:00:00.000000000 Z
15
+ date: 2013-08-05 00:00:00.000000000 Z
13
16
  dependencies:
14
17
  - !ruby/object:Gem::Dependency
15
18
  name: activesupport
@@ -60,7 +63,7 @@ dependencies:
60
63
  - !ruby/object:Gem::Version
61
64
  version: '0'
62
65
  - !ruby/object:Gem::Dependency
63
- name: ci_reporter
66
+ name: coveralls
64
67
  requirement: !ruby/object:Gem::Requirement
65
68
  none: false
66
69
  requirements:
@@ -76,7 +79,7 @@ dependencies:
76
79
  - !ruby/object:Gem::Version
77
80
  version: '0'
78
81
  - !ruby/object:Gem::Dependency
79
- name: vcr
82
+ name: ci_reporter
80
83
  requirement: !ruby/object:Gem::Requirement
81
84
  none: false
82
85
  requirements:
@@ -92,23 +95,23 @@ dependencies:
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
97
  - !ruby/object:Gem::Dependency
95
- name: webmock
98
+ name: mocha
96
99
  requirement: !ruby/object:Gem::Requirement
97
100
  none: false
98
101
  requirements:
99
- - - '='
102
+ - - ! '>='
100
103
  - !ruby/object:Gem::Version
101
- version: '1.9'
104
+ version: '0'
102
105
  type: :development
103
106
  prerelease: false
104
107
  version_requirements: !ruby/object:Gem::Requirement
105
108
  none: false
106
109
  requirements:
107
- - - '='
110
+ - - ! '>='
108
111
  - !ruby/object:Gem::Version
109
- version: '1.9'
112
+ version: '0'
110
113
  - !ruby/object:Gem::Dependency
111
- name: mocha
114
+ name: rake
112
115
  requirement: !ruby/object:Gem::Requirement
113
116
  none: false
114
117
  requirements:
@@ -124,7 +127,23 @@ dependencies:
124
127
  - !ruby/object:Gem::Version
125
128
  version: '0'
126
129
  - !ruby/object:Gem::Dependency
127
- name: rake
130
+ name: rspec
131
+ requirement: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ~>
135
+ - !ruby/object:Gem::Version
136
+ version: '2.11'
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ version: '2.11'
145
+ - !ruby/object:Gem::Dependency
146
+ name: vcr
128
147
  requirement: !ruby/object:Gem::Requirement
129
148
  none: false
130
149
  requirements:
@@ -140,23 +159,27 @@ dependencies:
140
159
  - !ruby/object:Gem::Version
141
160
  version: '0'
142
161
  - !ruby/object:Gem::Dependency
143
- name: rspec
162
+ name: webmock
144
163
  requirement: !ruby/object:Gem::Requirement
145
164
  none: false
146
165
  requirements:
147
- - - ~>
166
+ - - '='
148
167
  - !ruby/object:Gem::Version
149
- version: '2.11'
168
+ version: '1.9'
150
169
  type: :development
151
170
  prerelease: false
152
171
  version_requirements: !ruby/object:Gem::Requirement
153
172
  none: false
154
173
  requirements:
155
- - - ~>
174
+ - - '='
156
175
  - !ruby/object:Gem::Version
157
- version: '2.11'
176
+ version: '1.9'
158
177
  description: Enables Ruby applications to communicate with the Bigcommerce API V2.
159
- email: dev-accounts@bigcommerce.com
178
+ email:
179
+ - mark.rickerby@bigcommerce.com
180
+ - rob.howard@bigcommerce.com
181
+ - saranyan.vigraham@bigcommerce.com
182
+ - sasha.gerrand@bigcommerce.com
160
183
  executables: []
161
184
  extensions: []
162
185
  extra_rdoc_files: []
@@ -170,6 +193,7 @@ files:
170
193
  - ./lib/bigcommerce/connection.rb
171
194
  - ./lib/bigcommerce/version.rb
172
195
  - ./lib/bigcommerce.rb
196
+ - ./spec/big_commerce_spec.rb
173
197
  - ./spec/integration/orders_spec.rb
174
198
  - ./spec/spec_helper.rb
175
199
  - ./spec/support/integration_context.rb
@@ -177,10 +201,13 @@ files:
177
201
  - ./spec/unit/api_request_spec.rb
178
202
  - ./spec/unit/connection_spec.rb
179
203
  - ./spec/unit/date_time_spec.rb
204
+ - ./spec/unit/version_spec.rb
205
+ - spec/big_commerce_spec.rb
180
206
  - spec/integration/orders_spec.rb
181
207
  - spec/unit/api_request_spec.rb
182
208
  - spec/unit/connection_spec.rb
183
209
  - spec/unit/date_time_spec.rb
210
+ - spec/unit/version_spec.rb
184
211
  homepage: http://github.com/bigcommerce/bigcommerce-api-ruby
185
212
  licenses: []
186
213
  post_install_message:
@@ -201,12 +228,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
228
  version: '0'
202
229
  requirements: []
203
230
  rubyforge_project:
204
- rubygems_version: 1.8.23
231
+ rubygems_version: 1.8.24
205
232
  signing_key:
206
233
  specification_version: 3
207
234
  summary: Enables Ruby applications to communicate with the Bigcommerce API
208
235
  test_files:
236
+ - spec/big_commerce_spec.rb
209
237
  - spec/integration/orders_spec.rb
210
238
  - spec/unit/api_request_spec.rb
211
239
  - spec/unit/connection_spec.rb
212
240
  - spec/unit/date_time_spec.rb
241
+ - spec/unit/version_spec.rb