rsqoot 0.1.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec628307ce0c636974f1302b34c42ba6e207e74c
4
- data.tar.gz: 6cbdc7c584d68492fc0e6c128a3c88733ce3cd01
3
+ metadata.gz: db6629abd6587c3672911e89bb6686b648e13d0e
4
+ data.tar.gz: 93dd7b2d00e771f81bc89821a4f5ce0166f9edb9
5
5
  SHA512:
6
- metadata.gz: f8781dbae0339b5eb534ed866de0e753e3bf90269b5cb026aa2ab73a9d2562b26eed030e95531e1a3ad4bda66f60309d62fe6234f03d5ac39b344518b75c2d7d
7
- data.tar.gz: bfe98dc0764d75e32bf12d61125deb38963da7505ebfb85e734da73d326db624a45256c3bb758fca3417f6fbec33b298188ff3eeb83809ecd684b71a7e4a979e
6
+ metadata.gz: ef941d492eb2cb23deab2cfdf17692bd055d3634af1930e5eb49d6b8fbfd7c521d703a50b85c1cc3cc62e8996752057868940f33cf5de8e9d45678aa2c91c13f
7
+ data.tar.gz: 4d34799a2d1b2320e24e497815f6983af1b0e7ade53798308828645b20b4e6f8a7cba9badcebd4a47f4a130bba62641603a02e610a687bffc9d6ebd8bd691a31
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rsqoot (0.1.1)
5
+ hashie (~> 2.0.0)
6
+ json (~> 1.7.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ hashie (2.0.5)
12
+ json (1.7.7)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ rsqoot!
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Sqoot
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
- Sqoot.configure do |config|
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
- sqoot = Sqoot::Client.new
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 RSqoot
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 <<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
- template 'rsqoot_config.rb', 'config/initializers/rsqoot_config.rb'
12
+ copy_file 'rsqoot_config.rb', 'config/initializers/rsqoot_config.rb'
13
13
  end
14
14
  end
15
15
  end
@@ -1,4 +1,4 @@
1
- Sqoot.configure do |config|
1
+ RSqoot.configure do |config|
2
2
  # config.public_api_key = 'YOUR PUBLIC API KEY'
3
3
  # config.private_api_key = 'YOUR PRIVATE API KEY'
4
4
  # config.base_api_url = 'https://api.sqoot.com'
@@ -54,9 +54,10 @@ module RSqoot
54
54
  #
55
55
  # @return [String]
56
56
  def options_parser(options = {})
57
- options.map do |key, value|
57
+ query = options.map do |key, value|
58
58
  [key, value].map(&:to_s).join('=')
59
59
  end.join('&')
60
+ URI.encode query
60
61
  end
61
62
 
62
63
  end
@@ -1,3 +1,3 @@
1
1
  module RSqoot
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.2'
3
3
  end
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 [Sqoot]
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.1.1
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