officevibe 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 9df36f56caf69bb5b93266d250c38aee1d41a7f742519cbf363192b2f734beea
4
- data.tar.gz: c76d153bf31eae46d6991583eecbdbb3e21f0349d82ef4d0fd5f1acbb7bcf669
3
+ metadata.gz: 942d85a5bb8d7d60350a411f852204b13bbddb19eadfd5c13b5340e2a69220e6
4
+ data.tar.gz: cda5c25f277bb750bb306743f465b1f3977df79f0cbacd3e4202eb4a7729e728
5
5
  SHA512:
6
- metadata.gz: eb21aae1014fa5c8df29895095f80eeb2f71560a2bc7f7d537db309d1ead6b719a0a3f731fe3310d9fd38a2813c499cf70fab0a718020b8675604f3d07f40e82
7
- data.tar.gz: 281ae19e269c646c8c91bfbceb4f51e4215c3d958886e41af1a47a7b7ac13695e0ae493f9c735bab4fff578dda88c0254a6b0b0dfa810c2f2ff655e3edee0c55
6
+ metadata.gz: 6e04f8210a018deeb8f7d78362bac5b3901ac1cb00282ed11e6678d92f5f783f37e0582dc4625774d30312e00b7ee5f099bdb917682530caa93fa1bc5796ca47
7
+ data.tar.gz: 568a7cb177e7e83d3d4cb25133390f5b15ab81c5d081f1ab4f8aa8b041f77752e98a1ec94bc55f01a6d3cec66abe996c36b984743826c9521db9341b3cc82e04
data/.gitignore CHANGED
@@ -6,6 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
-
10
- # rspec failure tracking
11
9
  .rspec_status
10
+ .auth_token
11
+ *.gem
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in officevibe.gemspec
4
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,20 +1,36 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- officevibe (0.1.0)
4
+ officevibe (0.1.1)
5
+ activesupport (~> 5.2)
5
6
  faraday_middleware (~> 0.13.1)
6
7
  json (~> 2.2.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ activesupport (5.2.3)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ awesome_print (1.8.0)
18
+ coderay (1.1.2)
19
+ concurrent-ruby (1.1.5)
11
20
  diff-lcs (1.3)
12
21
  faraday (0.15.4)
13
22
  multipart-post (>= 1.2, < 3)
14
23
  faraday_middleware (0.13.1)
15
24
  faraday (>= 0.7.4, < 1.0)
25
+ i18n (1.6.0)
26
+ concurrent-ruby (~> 1.0)
16
27
  json (2.2.0)
28
+ method_source (0.9.2)
29
+ minitest (5.11.3)
17
30
  multipart-post (2.1.1)
31
+ pry (0.12.2)
32
+ coderay (~> 1.1.0)
33
+ method_source (~> 0.9.0)
18
34
  rake (10.5.0)
19
35
  rspec (3.8.0)
20
36
  rspec-core (~> 3.8.0)
@@ -29,13 +45,18 @@ GEM
29
45
  diff-lcs (>= 1.2.0, < 2.0)
30
46
  rspec-support (~> 3.8.0)
31
47
  rspec-support (3.8.0)
48
+ thread_safe (0.3.6)
49
+ tzinfo (1.2.5)
50
+ thread_safe (~> 0.1)
32
51
 
33
52
  PLATFORMS
34
53
  ruby
35
54
 
36
55
  DEPENDENCIES
56
+ awesome_print (~> 1.8.0)
37
57
  bundler (~> 2.0)
38
58
  officevibe!
59
+ pry (~> 0.12.2)
39
60
  rake (~> 10.0)
40
61
  rspec (~> 3.0)
41
62
 
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Officevibe
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/officevibe`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ An early-stage Ruby client for Officevibe.
6
4
 
7
5
  ## Installation
8
6
 
@@ -20,9 +18,56 @@ Or install it yourself as:
20
18
 
21
19
  $ gem install officevibe
22
20
 
21
+ ## Configuration
22
+
23
+ To get your auth token log in to the Officevibe app and copy the value of the officevibe.auth cookie; this can be done through the Developer Tools of your browser or any number of browser extensions (like EditThisCookie for Chrome).
24
+
25
+ ```ruby
26
+ client = Officevibe::Client.new("<your auth token here>")
27
+ ```
28
+
23
29
  ## Usage
24
30
 
25
- TODO: Write usage instructions here
31
+ ### Get Manageable Groups
32
+
33
+ ```ruby
34
+ client.get_groups
35
+ # => [
36
+ # {
37
+ # "id" => "12345678-1234-5678-9012-12345678901",
38
+ # "display_name" => "Accounting Department"
39
+ # }
40
+ # ]
41
+ ```
42
+
43
+ ### Get Engagement Report
44
+
45
+ ```ruby
46
+ client.get_engagement_report("12345678-1234-5678-9012-12345678901")
47
+ # => {"metric_groups"=>
48
+ # [{"id"=>"MG-4",
49
+ # "description"=>"The \"Relationship with Manager\" metric represents trust, communication and collaboration between employees and their direct manager.",
50
+ # "title"=>"Relationship with Manager",
51
+ # "is_effective"=>true,
52
+ # "value"=>9.9,
53
+ # "graph"=>
54
+ # {"scale_min"=>8.1,
55
+ # "scale_max"=>9.7,
56
+ # "zoom"=>6.25,
57
+ # "offset"=>0.39,
58
+ # "min_value"=>0.0,
59
+ # "max_value"=>10.0,
60
+ # "interval_type"=>3,
61
+ # "values"=>
62
+ # [{"date"=>"2019-04-14T00:00:00Z", "value"=>9.9},
63
+ # {"date"=>"2019-04-21T00:00:00Z", "value"=>9.9},
64
+ # {"date"=>"2019-04-28T00:00:00Z", "value"=>9.9},
65
+ # {"date"=>"2019-05-05T00:00:00Z", "value"=>9.9},
66
+ # {"date"=>"2019-05-12T00:00:00Z", "value"=>9.9},
67
+ # {"date"=>"2019-05-19T00:00:00Z", "value"=>9.9},
68
+ # {"date"=>"2019-05-26T00:00:00Z", "value"=>9.9},
69
+ # {"date"=>"2019-06-02T00:00:00Z", "value"=>9.9},
70
+ ```
26
71
 
27
72
  ## Development
28
73
 
@@ -32,7 +77,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
77
 
33
78
  ## Contributing
34
79
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/officevibe. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
80
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chrisb/officevibe. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
81
 
37
82
  ## License
38
83
 
@@ -40,4 +85,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
85
 
41
86
  ## Code of Conduct
42
87
 
43
- Everyone interacting in the Officevibe project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/officevibe/blob/master/CODE_OF_CONDUCT.md).
88
+ Everyone interacting in the Officevibe project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/chrisb/officevibe/blob/master/CODE_OF_CONDUCT.md).
data/bin/console CHANGED
@@ -2,13 +2,17 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "officevibe"
5
+ require "awesome_print"
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
8
9
 
10
+ auth_token = File.read("./.auth_token").strip
11
+ @client = Officevibe::Client.new(auth_token)
12
+
9
13
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
14
+ require "pry"
15
+ Pry.start
12
16
 
13
- require "irb"
14
- IRB.start(__FILE__)
17
+ # require "irb"
18
+ # IRB.start(__FILE__)
@@ -1,4 +1,11 @@
1
1
  # frozen_string_literal: true
2
+ require "faraday_middleware"
3
+ require "date"
4
+ require "officevibe/client_middleware"
5
+ require "active_support/core_ext/module/delegation"
6
+ require "active_support/core_ext/string/inflections"
7
+ require "active_support/core_ext/hash/indifferent_access"
8
+ require "active_support/core_ext/object/to_query"
2
9
 
3
10
  module Officevibe
4
11
  class Client
@@ -15,6 +22,8 @@ module Officevibe
15
22
  @auth_token = auth_token
16
23
  @connection = Faraday.new url: OFFICEVIBE_URL, headers: headers do |conn|
17
24
  conn.response :json, :content_type => /\bjson$/
25
+ conn.response :raise_error
26
+ conn.use Officevibe::ClientMiddleware
18
27
  conn.adapter Faraday.default_adapter
19
28
  end
20
29
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Officevibe
4
+ Error = Class.new(StandardError)
5
+ InvalidAuthToken = Class.new(Officevibe::Error)
6
+
7
+ class ClientMiddleware < Faraday::Response::Middleware
8
+ def on_complete(env)
9
+ case env[:status]
10
+ when 302
11
+ raise Officevibe::InvalidAuthToken, JSON.parse(env.body)["message"]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Officevibe
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/officevibe.rb CHANGED
@@ -1,7 +1,2 @@
1
1
  require "officevibe/version"
2
2
  require "officevibe/client"
3
-
4
- module Officevibe
5
- class Error < StandardError; end
6
- # Your code goes here...
7
- end
data/officevibe.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["chrisb@users.noreply.github.com"]
11
11
 
12
12
  spec.summary = "An Officevibe client for Ruby"
13
- spec.description = "An Officevibe client for Ruby"
13
+ spec.description = "An Officevibe client for Ruby. Currently supports only a few things."
14
14
  spec.homepage = "https://github.com/chrisb/officevibe-ruby"
15
15
  spec.license = "MIT"
16
16
 
@@ -25,8 +25,11 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_dependency "faraday_middleware", "~> 0.13.1"
27
27
  spec.add_dependency "json", "~> 2.2.0"
28
+ spec.add_dependency "activesupport", "~> 5.2"
28
29
 
29
30
  spec.add_development_dependency "bundler", "~> 2.0"
30
31
  spec.add_development_dependency "rake", "~> 10.0"
31
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.add_development_dependency "pry", "~> 0.12.2"
34
+ spec.add_development_dependency "awesome_print", "~> 1.8.0"
32
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: officevibe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Bielinski
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.2'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +94,35 @@ dependencies:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: '3.0'
83
- description: An Officevibe client for Ruby
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.12.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.12.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: awesome_print
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.8.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.8.0
125
+ description: An Officevibe client for Ruby. Currently supports only a few things.
84
126
  email:
85
127
  - chrisb@users.noreply.github.com
86
128
  executables: []
@@ -100,6 +142,7 @@ files:
100
142
  - bin/setup
101
143
  - lib/officevibe.rb
102
144
  - lib/officevibe/client.rb
145
+ - lib/officevibe/client_middleware.rb
103
146
  - lib/officevibe/version.rb
104
147
  - officevibe.gemspec
105
148
  homepage: https://github.com/chrisb/officevibe-ruby