nri-feature_interest 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 92ee9a1a233e550dd085589b8b83dadb2f8b6c7f
4
+ data.tar.gz: 92367c3dded2458d84fb98e2030ef758c4adc800
5
+ SHA512:
6
+ metadata.gz: f269b328807ba1625db060ebc23382ac7dd1d9fa805196a401602e94904076aad3362b9f1df9dc6f6fc7cc710d1ee190578e56358b5c625e0d3da0c587c12f5f
7
+ data.tar.gz: bfde03aa42bbe9b0e971df491467f8fdaeaed6ad2215e4d8c3a1a7104c2bf96e37b767f713f47713c394b39867d3ef261c50064cd5671ef03e7ffb5b42b24b6c
@@ -0,0 +1,2 @@
1
+ require "nri/feature_interest/admin"
2
+ require "nri/feature_interest/feature"
@@ -0,0 +1,43 @@
1
+ require "json"
2
+ require "net/http"
3
+ require "uri"
4
+
5
+ module Nri
6
+ module FeatureInterest
7
+ class Admin
8
+ def initialize(origin)
9
+ @origin = URI(origin)
10
+ @http = Net::HTTP.new(@origin.host, @origin.port)
11
+ end
12
+
13
+ def get_features_admin(authorization:)
14
+ uri = URI("#{@origin}/features/admin")
15
+
16
+ req = Net::HTTP::Get.new(uri)
17
+ req["Authorization"] = authorization
18
+
19
+ @http.request(req)
20
+ end
21
+
22
+ def post_features(body:, authorization:)
23
+ uri = URI("#{@origin}/features")
24
+
25
+ req = Net::HTTP::Post.new(uri)
26
+ req["Content-Type"] = "application/json"
27
+ req["Authorization"] = authorization
28
+
29
+ @http.request(req, body)
30
+ end
31
+
32
+ def put_features_by_feature_id(feature_id, body:, authorization:)
33
+ uri = URI("#{@origin}/features/#{feature_id}")
34
+
35
+ req = Net::HTTP::Put.new(uri)
36
+ req["Content-Type"] = "application/json"
37
+ req["Authorization"] = authorization
38
+
39
+ @http.request(req, body)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,68 @@
1
+ require "json"
2
+ require "net/http"
3
+ require "uri"
4
+
5
+ module Nri
6
+ module FeatureInterest
7
+ class Feature
8
+ def initialize(origin)
9
+ @origin = URI(origin)
10
+ @http = Net::HTTP.new(@origin.host, @origin.port)
11
+ end
12
+
13
+ def get_features(authorization:)
14
+ uri = URI("#{@origin}/features")
15
+
16
+ req = Net::HTTP::Get.new(uri)
17
+ req["Authorization"] = authorization
18
+
19
+ @http.request(req)
20
+ end
21
+
22
+ def get_features_by_feature_id(feature_id, authorization:)
23
+ uri = URI("#{@origin}/features/#{feature_id}")
24
+
25
+ req = Net::HTTP::Get.new(uri)
26
+ req["Authorization"] = authorization
27
+
28
+ @http.request(req)
29
+ end
30
+
31
+ def post_features_by_feature_id_upvote(feature_id, authorization:)
32
+ uri = URI("#{@origin}/features/#{feature_id}/upvote")
33
+
34
+ req = Net::HTTP::Post.new(uri)
35
+ req["Authorization"] = authorization
36
+
37
+ @http.request(req)
38
+ end
39
+
40
+ def delete_features_by_feature_id_upvote(feature_id, authorization:)
41
+ uri = URI("#{@origin}/features/#{feature_id}/upvote")
42
+
43
+ req = Net::HTTP::Delete.new(uri)
44
+ req["Authorization"] = authorization
45
+
46
+ @http.request(req)
47
+ end
48
+
49
+ def post_features_by_feature_id_interview(feature_id, authorization:)
50
+ uri = URI("#{@origin}/features/#{feature_id}/interview")
51
+
52
+ req = Net::HTTP::Post.new(uri)
53
+ req["Authorization"] = authorization
54
+
55
+ @http.request(req)
56
+ end
57
+
58
+ def delete_features_by_feature_id_interview(feature_id, authorization:)
59
+ uri = URI("#{@origin}/features/#{feature_id}/interview")
60
+
61
+ req = Net::HTTP::Delete.new(uri)
62
+ req["Authorization"] = authorization
63
+
64
+ @http.request(req)
65
+ end
66
+ end
67
+ end
68
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nri-feature_interest
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Hardy Jones
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: eng@noredink.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/nri/feature_interest.rb
20
+ - lib/nri/feature_interest/admin.rb
21
+ - lib/nri/feature_interest/feature.rb
22
+ homepage: https://github.com/NoRedInk/ruby-feature-interest
23
+ licenses:
24
+ - BSD-3-Clause
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.6.11
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Generated modules for interfacing with NoRedInk's Feature Interest REST API
46
+ test_files: []