whitehouse 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.test +4 -0
- data/.gitignore +23 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +84 -0
- data/Rakefile +8 -0
- data/lib/whitehouse/authentication.rb +22 -0
- data/lib/whitehouse/client/catalog.rb +17 -0
- data/lib/whitehouse/client/order.rb +57 -0
- data/lib/whitehouse/client/webhook.rb +41 -0
- data/lib/whitehouse/client.rb +107 -0
- data/lib/whitehouse/configurable.rb +65 -0
- data/lib/whitehouse/default.rb +71 -0
- data/lib/whitehouse/error.rb +22 -0
- data/lib/whitehouse/order.rb +112 -0
- data/lib/whitehouse/version.rb +3 -0
- data/lib/whitehouse.rb +33 -0
- data/spec/cassettes/catalog.yml +3224 -0
- data/spec/cassettes/client.yml +134 -0
- data/spec/cassettes/order.yml +103 -0
- data/spec/cassettes/webhook.yml +98 -0
- data/spec/client/catalog_spec.rb +19 -0
- data/spec/client/order_spec.rb +37 -0
- data/spec/client/webhook_spec.rb +28 -0
- data/spec/client_spec.rb +17 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/whitehouse_spec.rb +46 -0
- data/whitehouse.gemspec +32 -0
- metadata +223 -0
data/lib/whitehouse.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "whitehouse/client"
|
2
|
+
require "whitehouse/default"
|
3
|
+
require "whitehouse/order"
|
4
|
+
|
5
|
+
# Ruby toolkit for the WHCC API
|
6
|
+
module Whitehouse
|
7
|
+
class << self
|
8
|
+
include Whitehouse::Configurable
|
9
|
+
|
10
|
+
# API client based on configured options {Configurable}
|
11
|
+
#
|
12
|
+
# @return [Whitehouse::Client] API wrapper
|
13
|
+
def client
|
14
|
+
@client = Whitehouse::Client.new(options) unless defined?(@client) && @client.same_options?(options)
|
15
|
+
@client
|
16
|
+
end
|
17
|
+
|
18
|
+
# @private
|
19
|
+
def respond_to_missing?(method_name, include_private=false); client.respond_to?(method_name, include_private); end if RUBY_VERSION >= "1.9"
|
20
|
+
# @private
|
21
|
+
def respond_to?(method_name, include_private=false); client.respond_to?(method_name, include_private) || super; end if RUBY_VERSION < "1.9"
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def method_missing(method_name, *args, &block)
|
26
|
+
return super unless client.respond_to?(method_name)
|
27
|
+
client.send(method_name, *args, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Whitehouse.setup
|