modern-pricing 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3abacc8425a2a1537cd7aba9dc5b92a05e6dd971
4
+ data.tar.gz: bb34083582fd5401e6eecd7379ef203da66b23a1
5
+ SHA512:
6
+ metadata.gz: 0cccb30ba767e0e8bf7ce595d9a0992e1664c476d8c6d2bc6c05ea4ed93651849f9c7af2aed148ecfd1032c8f267930bfad496f20215cfc9daa8ffbbb06b4dab
7
+ data.tar.gz: 5abc86e2a1c2db001c99543b58d0c552c037e09dedff6473f3141f862f929261bc85f8d9ce34ab6295f8e90c3228721fc1f17bc45a35d5d43bb67dbf166d3b67
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013-2019 John Marbach
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
@@ -0,0 +1,47 @@
1
+ module ModernPricing
2
+
3
+ class Client
4
+
5
+ module Connection
6
+
7
+ def get(path, options = {})
8
+ request :get, path, options
9
+ end
10
+
11
+ def post(path, options = {})
12
+ request :post, path, options
13
+ end
14
+
15
+ def put(path, options = {})
16
+ request :put, path, options
17
+ end
18
+
19
+ def delete(path, options = {})
20
+ request :delete, path, options
21
+ end
22
+
23
+ private
24
+
25
+ def request(http_method, path, options)
26
+ response = self.class.send(http_method, path, { body: options })
27
+ data = response.parsed_response
28
+ parse_data(data)
29
+ end
30
+
31
+ def parse_data(original_data)
32
+ return unless original_data
33
+
34
+ data = original_data.keys.count <= 2 ? original_data.values.first : original_data
35
+
36
+ case data
37
+ when Hash then Resource.new(self, data)
38
+ when Array then ResourceCollection.new(self, original_data)
39
+ when nil then nil
40
+ else data
41
+ end
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,13 @@
1
+ module ModernPricing
2
+ class Client
3
+
4
+ module Scores
5
+
6
+ def scores(options = {})
7
+ post("/scores", options)
8
+ end
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require "modern-pricing/client/connection"
2
+ require "modern-pricing/client/scores"
3
+
4
+ module ModernPricing
5
+
6
+ class Client
7
+ include HTTParty
8
+ include ModernPricing::Client::Connection
9
+ include ModernPricing::Client::Scores
10
+
11
+ base_uri "https://modernpricing.com/v1"
12
+ format :json
13
+
14
+ def initialize(access_token = nil)
15
+ access_token ||= ENV["MODERN_PRICING_API_KEY"]
16
+ self.class.default_options.merge!(headers: { 'Authorization' => "Token #{access_token}" })
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,11 @@
1
+ module ModernPricing
2
+
3
+ class Relation < Struct.new(:client, :href)
4
+
5
+ def get(options = {})
6
+ client.get href, options
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,13 @@
1
+ module ModernPricing
2
+
3
+ class Resource
4
+ attr_reader :rels, :data
5
+
6
+ def initialize(client, data)
7
+ @client = client
8
+ @data = data
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,3 @@
1
+ module ModernPricing
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,9 @@
1
+ require "httparty"
2
+ require "modern-pricing/version"
3
+ require "modern-pricing/relation"
4
+ require "modern-pricing/resource"
5
+ require "modern-pricing/client"
6
+
7
+ module ModernPricing
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: modern-pricing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Marbach
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email: john@modernpricing.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - LICENSE.txt
62
+ - README.md
63
+ - lib/modern-pricing.rb
64
+ - lib/modern-pricing/client.rb
65
+ - lib/modern-pricing/client/connection.rb
66
+ - lib/modern-pricing/client/scores.rb
67
+ - lib/modern-pricing/relation.rb
68
+ - lib/modern-pricing/resource.rb
69
+ - lib/modern-pricing/version.rb
70
+ homepage: https://modernpricing.com
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '2.3'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.6.11
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Intelligent pricing information that will drive your business forward.
94
+ test_files: []