mvclient 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: ea542d1decef8e9c2785aa140ca9b2077d11f6eb
4
- data.tar.gz: 26e612d47a42c82064ed90dfd9c496b3053a0ba2
3
+ metadata.gz: 346159f60bb02d2432e4cec68c239e158e1d63b8
4
+ data.tar.gz: c42cdef32bcd856b72dee4995ea3bdf636ab2fe1
5
5
  SHA512:
6
- metadata.gz: 9b23c70bdbcddf3f924094247a38af94d677e1e618c0a6fa09eba1c37000d48f1b0c797f096a3016ccd941dcc78d9213e2869bde7f9ef06ccb40f348239deb07
7
- data.tar.gz: fb0cb02cff29445a011c81d3ef976f38e1dab4a9ba2dfbcfa8e430757491b6d4327465821b876197a522b4a76dc4f2fef759dc8c39e23071abc5c657093c09c9
6
+ metadata.gz: 4bc6dc00b2c7b965d6ecd9105f56c2698109d1653159d019c1c3873f2a4ee699143a540d578dd5ce3131d8858cf75f7a62d2d3fa6552a6c94972f65d0b8a0144
7
+ data.tar.gz: f25306096e3f623d2e0d5546205e09d49204c0d67cc13d083abf901908c75514bd688f39235a6344609c7e7fa5ea01bb6acd380d6611797160a1e0e0faa99f70
data/README.md CHANGED
@@ -76,7 +76,7 @@ returns balance information
76
76
  ### Send appreciation
77
77
 
78
78
  ```ruby
79
- @client.send_appreciation! user_id, 1.00, "Here, have a dollar", value_id
79
+ @client.send_appreciation! user_id, amount: 1.00, note: "Here, have a dollar", company_value_id: value_id, private: false
80
80
  ```
81
81
 
82
82
  ### Get announcements
@@ -94,7 +94,7 @@ returns balance information
94
94
  <a id="command-line-tool"></a>
95
95
  ## command-line tool
96
96
 
97
- A command-line tool is also provided in `bin/mvclient.rb`. Use `--help` to receive usage information on the command line.
97
+ A command-line tool is also provided in `bin/mvclient`. Use `--help` to receive usage information.
98
98
 
99
99
  ### Log in
100
100
 
@@ -133,4 +133,4 @@ Success! Jane Doe has received your appreciation.
133
133
 
134
134
  ### Debugging
135
135
 
136
- Set MOTIVOSITY_DEBUG=1 to enable logging of all communication with Motivosity to stderr
136
+ Set `MOTIVOSITY_DEBUG=1` to enable logging of all communication with Motivosity to stderr
@@ -26,7 +26,7 @@ def require_options(*required_options)
26
26
  required_options.each do |opt|
27
27
  unless $options[opt] && $options[opt].length > 0
28
28
  missing = true
29
- $stderr.puts "missing required parameter: #{opt.to_s}; use --help for more information"
29
+ $stderr.puts "missing required parameter: #{opt.to_s}; use mvclient <command> --help for more information"
30
30
  end
31
31
  end
32
32
  exit(1) if missing
@@ -142,7 +142,7 @@ COMMANDS = {
142
142
  user_id = users[0]['id']
143
143
  end
144
144
 
145
- response = $client.send_appreciation! user_id, $options[:amount] || 0, $options[:note] || "", value_id, !!$options[:private]
145
+ response = $client.send_appreciation! user_id, amount: $options[:amount], note: $options[:note], company_value_id: value_id, private: $options[:private]
146
146
  puts response['growl']['title'] + " " + response['growl']['content']
147
147
  }
148
148
  }
@@ -48,14 +48,13 @@ module Motivosity
48
48
 
49
49
  # sends appreciation to another User
50
50
  # raises BalanceError if insufficient funds exist
51
- def send_appreciation!(toUser_id, amount, note, company_value_id = nil, private = false)
52
- options = {}
53
- options["companyValueID"] = company_value_id if company_value_id
54
- options["amount"] = amount.to_s
55
- options["note"] = note
56
- options["privateAppreciation"] = private
57
- options["toUserID"] = toUser_id
58
- put "/api/v1/user/#{toUser_id}/appreciation", {}, options
51
+ def send_appreciation!(user_id, opts = {})
52
+ params = { "toUserID" => user_id }
53
+ params["companyValueID"] = opts[:company_value_id] if opts[:company_value_id]
54
+ params["amount"] = opts[:amount] if opts[:amount]
55
+ params["note"] = opts[:note] if opts[:note]
56
+ params["privateAppreciation"] = opts[:private] || false
57
+ put "/api/v1/user/#{user_id}/appreciation", {}, params
59
58
  end
60
59
 
61
60
  # returns recent announcements
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mvclient'
3
- s.version = '0.0.1'
4
- s.date = '2015-04-08'
3
+ s.version = '0.0.2'
4
+ s.date = '2015-04-09'
5
5
  s.summary = "Motivosity API Client"
6
6
  s.description = "A minimal Motivosity API v1 wrapper for Ruby, plus a command-line tool"
7
7
  s.authors = ["Jeremy Stanley"]
@@ -14,4 +14,4 @@ Gem::Specification.new do |s|
14
14
  s.required_ruby_version = '>= 1.9.3'
15
15
  s.add_dependency 'httparty', '~> 0'
16
16
  s.add_dependency 'http-cookie', '~> 1'
17
- end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvclient
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
  - Jeremy Stanley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty