whitehouse 0.0.1 → 0.0.2

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: a6d7e235ec57af1cf16316c8dc68db684a1276b5
4
- data.tar.gz: db7299985bfb54caa505228c8a6f0f3f665cba97
3
+ metadata.gz: 5f00fb3cfe708e67a63a6282d84330b908fca9e5
4
+ data.tar.gz: fd0c580e2219830fc47cd91f172b01c8128f710d
5
5
  SHA512:
6
- metadata.gz: b6e56a35c6cff590da279b07b43194ec50fff942becbdd00e7b8456e48ad28a199039f720a2cb4f8884820576b06a4f2384db282ac3caa6c4d84f0d318e24771
7
- data.tar.gz: 9d0116ccbe9b8b6b7269a20d0fe29c7b89738f2b8c5142508aa88c7250c0e00917aeac42b218d2405ca2a0c3bf514236c0661149c761c17daf73784ba4cc6f7a
6
+ metadata.gz: 01484f7f628c0125fada004ef248848787d04625ae48ba7481aa50fb974386ff4876c489ebcc06521f867787d39fae6a2873368be7d153ff2f7ab29845e70895
7
+ data.tar.gz: 54566a37895fcf886304ac99910725ec7facb00aa140968271b911d32535fd3031b073c27b5789a5e15345971b8881c901f908134d29c131c2ffd9c5e275f299
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Whitehouse [![Build Status](https://travis-ci.org/whcc/whcc_ruby.svg?branch=master)](https://travis-ci.org/whcc/whcc_ruby)
1
+ # Whitehouse [![Build Status](https://travis-ci.org/whcc/whcc_ruby.svg?branch=master)](https://travis-ci.org/whcc/whcc_ruby) [![Gem Version](https://badge.fury.io/rb/whitehouse.svg)](http://badge.fury.io/rb/whitehouse) [![Coverage Status](https://coveralls.io/repos/whcc/whcc_ruby/badge.png)](https://coveralls.io/r/whcc/whcc_ruby) [![Code Climate](https://codeclimate.com/github/whcc/whcc_ruby/badges/gpa.svg)](https://codeclimate.com/github/whcc/whcc_ruby)
2
2
 
3
3
  Ruby client for the WHCC API.
4
4
 
@@ -20,6 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ### Authentication
22
22
  Configuration can be done at the module level:
23
+
23
24
  ```ruby
24
25
  Whitehouse.configure do |c|
25
26
  c.consumer_key = 'FA2DBC52662850A7B53B'
@@ -28,11 +29,13 @@ end
28
29
  ```
29
30
 
30
31
  at the client instance level:
32
+
31
33
  ```ruby
32
34
  client = Whitehouse::Client.new(consumer_key: 'FA2DBC52662850A7B53B', consumer_secret: 'rPTa7aIydCI=')
33
35
  ```
34
36
 
35
37
  or via environment variables:
38
+
36
39
  ```
37
40
  WHCC_CONSUMER_KEY='FA2DBC52662850A7B53B'
38
41
  WHCC_CONSUMER_SECRET='rPTa7aIydCI='
@@ -86,7 +86,7 @@ module Whitehouse
86
86
 
87
87
  def check_errors(response)
88
88
  raise Error, response.status unless response.success?
89
- raise Error::CODES[response.body.ErrorNumber], response.body.Message if response.body.ErrorNumber
89
+ raise Error::CODES.fetch(response.body.ErrorNumber, Error), response.body.Message if response.body.ErrorNumber
90
90
  end
91
91
 
92
92
  def init_connection(oauth = false)
@@ -2,21 +2,43 @@ module Whitehouse
2
2
  class Error < StandardError
3
3
  ConfigurationError = Class.new(::ArgumentError)
4
4
 
5
+ ImageHashMismatch = Class.new(self)
6
+ ImageNotFound = Class.new(self)
7
+ ErrorCopyingFiles = Class.new(self)
8
+ InvalidCallbackURI = Class.new(self)
9
+ CallbackVerification = Class.new(self)
10
+
5
11
  NotAuthorized = Class.new(self)
6
12
  AuthorizationExpired = Class.new(NotAuthorized)
13
+ InvalidCredentials = Class.new(NotAuthorized)
14
+ IncorrectGrantType = Class.new(NotAuthorized)
7
15
 
8
16
  InvalidOrder = Class.new(self)
9
17
  IncorrectOrderImport = Class.new(InvalidOrder)
10
18
  InvalidBusinessRules = Class.new(InvalidOrder)
11
19
  InvalidConfirmationId = Class.new(InvalidOrder)
12
20
  EntryAlreadySubmitted = Class.new(InvalidOrder)
21
+ UnsupportedVersion = Class.new(InvalidOrder)
22
+ InvalidEmail = Class.new(InvalidOrder)
13
23
 
14
24
  CODES = {
25
+ "400.01" => ImageHashMismatch,
26
+ "400.02" => ImageNotFound,
27
+ "400.03" => ErrorCopyingFiles,
28
+ "400.04" => InvalidCallbackURI,
29
+ "400.05" => CallbackVerification,
30
+ "403" => NotAuthorized,
15
31
  "403.01" => AuthorizationExpired,
32
+ "403.02" => InvalidCredentials,
33
+ "403.03" => InvalidCredentials,
34
+ "403.04" => InvalidCredentials,
35
+ "403.05" => IncorrectGrantType,
16
36
  "412.01" => IncorrectOrderImport,
17
37
  "412.02" => InvalidBusinessRules,
18
38
  "412.03" => InvalidConfirmationId,
19
39
  "412.04" => EntryAlreadySubmitted,
40
+ "412.05" => UnsupportedVersion,
41
+ "412.06" => InvalidEmail
20
42
  }.freeze
21
43
  end
22
44
  end
@@ -92,7 +92,7 @@ module Whitehouse
92
92
  "ProductUID" => item.uid,
93
93
  "Quantity" => 1,
94
94
  "LineItemID" => i,
95
- "LayoutRotation" => item.rotation}
95
+ "LayoutRotation" => item.rotation || 0}
96
96
  end
97
97
  end
98
98
 
@@ -1,3 +1,3 @@
1
1
  module Whitehouse
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
1
3
  require 'pry'
2
4
  require 'dotenv'
3
5
  Dotenv.load '.env.test'
data/whitehouse.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "pry"
26
26
  spec.add_development_dependency "vcr"
27
27
  spec.add_development_dependency "webmock"
28
+ spec.add_development_dependency "coveralls"
28
29
 
29
30
  spec.add_dependency "faraday"
30
31
  spec.add_dependency "faraday_middleware"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitehouse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - travisdahlke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: coveralls
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: faraday
113
127
  requirement: !ruby/object:Gem::Requirement