rsqoot 0.1.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +18 -0
- data/README.md +19 -9
- data/lib/generators/rsqoot/config_generator.rb +3 -3
- data/lib/generators/rsqoot/templates/rsqoot_config.rb +1 -1
- data/lib/rsqoot/request.rb +2 -1
- data/lib/rsqoot/version.rb +1 -1
- data/lib/rsqoot.rb +10 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db6629abd6587c3672911e89bb6686b648e13d0e
|
4
|
+
data.tar.gz: 93dd7b2d00e771f81bc89821a4f5ce0166f9edb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef941d492eb2cb23deab2cfdf17692bd055d3634af1930e5eb49d6b8fbfd7c521d703a50b85c1cc3cc62e8996752057868940f33cf5de8e9d45678aa2c91c13f
|
7
|
+
data.tar.gz: 4d34799a2d1b2320e24e497815f6983af1b0e7ade53798308828645b20b4e6f8a7cba9badcebd4a47f4a130bba62641603a02e610a687bffc9d6ebd8bd691a31
|
data/Gemfile.lock
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
RSqoot
|
2
2
|
======
|
3
3
|
|
4
4
|
A Ruby Wrapper For Sqoot API V2
|
@@ -23,15 +23,25 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
|
27
|
-
# config.public_api_key = 'YOUR PUBLIC API KEY'
|
28
|
-
# config.private_api_key = 'YOUR PRIVATE API KEY'
|
29
|
-
# config.base_api_url = 'https://api.sqoot.com'
|
30
|
-
# config.authentication_method = :header
|
31
|
-
# config.read_timeout = 20
|
32
|
-
end
|
26
|
+
#### General configuration options
|
33
27
|
|
34
|
-
|
28
|
+
public_api_key # YOUR PUBLIC API KEY
|
29
|
+
private_api_key # YOUR PRIVATE API KEY
|
30
|
+
base_api_url # 'https://api.sqoot.com' by default
|
31
|
+
authentication_method # :header by default
|
32
|
+
read_timeout # 20 by default
|
33
|
+
|
34
|
+
There’s a handy generator that generates the default configuration file into config/initializers directory. Run the following generator command, then edit the generated file.
|
35
|
+
|
36
|
+
rails g rsqoot:config
|
37
|
+
|
38
|
+
You can also change your configuration in your instance, such as below:
|
39
|
+
|
40
|
+
sqoot ||= RSqoot::Client.new(public_api_key: "YOUR PUBLIC API KEY")
|
41
|
+
|
42
|
+
#### Basic Usages
|
43
|
+
|
44
|
+
sqoot ||= RSqoot::Client.new
|
35
45
|
|
36
46
|
sqoot.deals
|
37
47
|
#=> returns a list of deals
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module
|
1
|
+
module Rsqoot
|
2
2
|
module Generators
|
3
3
|
class ConfigGenerator < Rails::Generators::Base
|
4
4
|
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
5
5
|
|
6
|
-
desc
|
6
|
+
desc <<-DESC
|
7
7
|
Description:
|
8
8
|
Copies RSqoot configuration file to your application's initializer directory.
|
9
9
|
DESC
|
10
10
|
|
11
11
|
def copy_config_file
|
12
|
-
|
12
|
+
copy_file 'rsqoot_config.rb', 'config/initializers/rsqoot_config.rb'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/rsqoot/request.rb
CHANGED
data/lib/rsqoot/version.rb
CHANGED
data/lib/rsqoot.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
require "rsqoot/client"
|
2
2
|
|
3
|
+
# load Rails/Railtie
|
4
|
+
begin
|
5
|
+
require 'rails'
|
6
|
+
rescue LoadError
|
7
|
+
#do nothing
|
8
|
+
end
|
9
|
+
|
3
10
|
module RSqoot
|
4
11
|
|
5
12
|
class << self
|
@@ -7,10 +14,12 @@ module RSqoot
|
|
7
14
|
|
8
15
|
# Configure default credentials easily
|
9
16
|
#
|
10
|
-
# @yield [
|
17
|
+
# @yield [RSqoot]
|
11
18
|
def configure
|
12
19
|
load_defaults
|
13
20
|
yield self
|
21
|
+
raise "You must add your own public api key to initializer ." if self.public_api_key.nil?
|
22
|
+
raise "You must add your own private api key to initializer ." if self.private_api_key.nil?
|
14
23
|
raise "Authentication method must be :header or :parameter ." if !AUTHENTICATION_METHODS.include? self.authentication_method
|
15
24
|
true
|
16
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsqoot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Liu
|
@@ -48,6 +48,7 @@ extra_rdoc_files:
|
|
48
48
|
files:
|
49
49
|
- .gitignore
|
50
50
|
- Gemfile
|
51
|
+
- Gemfile.lock
|
51
52
|
- LICENSE
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|