cs 0.1.3 → 0.1.4

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: 3c833d41fcb9aa813c7aeda87ad3aac228ace39d
4
- data.tar.gz: 0e73999b1157e0641241a7fbf1ddb985416e16df
3
+ metadata.gz: 63eed43cc77b773bac24f95586ee557c5f190faa
4
+ data.tar.gz: 00bb1526dd327a88d7a84a6eae2a22c5917278ed
5
5
  SHA512:
6
- metadata.gz: b2397a73ae5ba94dab965f2d47a2e4f00d26611fbf1e382761a9488527c105e9c904ae053f4aea8815ba85c0563f3ff5bc2d047da9909ee2145cf93eabc6c093
7
- data.tar.gz: 53f83903a01000f4690768f40bdc321340071147559d33126cdd6a1ee1f7ca4ac04fdd1c919ab0cd0f941989e79c38f4237a08a105f8dead596eb2ae88fc9f28
6
+ metadata.gz: 0642bc7c0e29c0d90eb0b776710fa26e902de07c23675ed6e818ea245266373fcba3762d7f1958403ebbb7e3ebd08909dede27f1118e02741b64b61e758bd028
7
+ data.tar.gz: eb8f5b6c67d4d3582fcf5df831f677ea4e897edfb99417136753c15e052db63d40d6e93c4e220ace15a2362597d1fa7eb540d9178352afb119b772d20cccadc2
data/README.md CHANGED
@@ -1,12 +1,19 @@
1
1
  # Commonsense::Ruby::Lib
2
2
  Client library to communicate with CommonSense written in ruby
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/cs.svg)](http://badge.fury.io/rb/cs)
4
5
  [![Code Climate](https://codeclimate.com/github/senseobservationsystems/commonsense-ruby-lib.png)](https://codeclimate.com/github/senseobservationsystems/commonsense-ruby-lib)
5
6
  [![Build Status](https://travis-ci.org/senseobservationsystems/commonsense-ruby-lib.png?branch=master)](https://travis-ci.org/senseobservationsystems/commonsense-ruby-lib)
6
7
 
8
+ RDoc [Documentation](http://rdoc.info/github/senseobservationsystems/commonsense-ruby-lib/frames)
9
+
7
10
  ## Installation
8
11
 
9
- Add this line to your application's Gemfile:
12
+ Install with rubygems :
13
+
14
+ $ gem install cs
15
+
16
+ If you use Bundler to manage gem dependency, add this line to your Gemfile:
10
17
 
11
18
  gem 'cs'
12
19
 
@@ -14,10 +21,6 @@ And then execute:
14
21
 
15
22
  $ bundle
16
23
 
17
- Or install it yourself as:
18
-
19
- $ gem install cs
20
-
21
24
  ## Usage
22
25
 
23
26
  ### Authentication
@@ -30,7 +30,8 @@ CS::load_CLI
30
30
  ##
31
31
  OPTIONS = {
32
32
  config_file: "#{ENV['HOME']}/.cs.yml",
33
- log_level: INFO
33
+ log_level: INFO,
34
+ base_uri: 'https://api.sense-os.nl'
34
35
  }
35
36
 
36
37
  OptionParser.new do |opts|
@@ -54,6 +55,11 @@ OptionParser.new do |opts|
54
55
  OPTIONS[:log_level] = level
55
56
  end
56
57
 
58
+ opts.on("-b", "--base-uri COMMONSENSE_URI", "Commonsense URI") do |v|
59
+ OPTIONS[:base_uri] = v
60
+ puts "API : #{OPTIONS[:base_uri]}"
61
+ end
62
+
57
63
  opts.separator ""
58
64
  opts.on_tail("-h", "--help", "Show this message") do
59
65
  puts opts
@@ -77,7 +83,7 @@ def config(key=nil)
77
83
  end
78
84
 
79
85
  def new_client(user=nil)
80
- client = CS::Client.new
86
+ client = CS::Client.new(base_uri: OPTIONS[:base_uri])
81
87
 
82
88
  if user == false
83
89
  return client
data/lib/cs.rb CHANGED
@@ -50,7 +50,7 @@ module CS
50
50
  # client.base_uri = 'https://api.dev.sense-os.nl'
51
51
  #
52
52
  class Client
53
- attr_accessor :session, :base_uri
53
+ attr_accessor :session
54
54
  attr_reader :logger
55
55
 
56
56
  def initialize(opts={})
@@ -60,6 +60,11 @@ module CS
60
60
  @base_uri = options[:base_uri]
61
61
  end
62
62
 
63
+ def base_uri=(uri)
64
+ @base_uri = uri
65
+ session.base_uri = uri
66
+ end
67
+
63
68
  def logger=(logger)
64
69
  @logger = logger
65
70
  @session.logger = logger if @session
@@ -134,6 +134,7 @@ module CS
134
134
  end
135
135
 
136
136
  def base_uri=(uri = nil)
137
+ @base_uri = uri
137
138
  auth_proxy.base_uri = uri
138
139
  end
139
140
 
@@ -1,3 +1,3 @@
1
1
  module CS
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmy Yulrizka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2014-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy