michael_taylor_sdk 1.0.1 → 1.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
  SHA256:
3
- metadata.gz: '03613032665901e43dc7312cdda7a49d87b9f83b64b7dfcdbdf770f4bfcc738c'
4
- data.tar.gz: c38a19752db68e459cf04cc60e1ce40a0799f8728e4d2a8d9489544bcdbcb08b
3
+ metadata.gz: 79136525a44549f8e47452b9f228e88fd65e80926d9673519bba0b4a0e1d308a
4
+ data.tar.gz: 89c130376085c61cca9ca719b554b809cf6caad9fd38ce1e780ff0cc63f598cf
5
5
  SHA512:
6
- metadata.gz: eb0ff8e3afeba6adbda9fe7384dc84f46609d9787e69b7680e486b0dd16c2e44d7b6a124e1aae4f2cf8769275fb06e4a5531a1fcf6d97fed29c7583e338385dc
7
- data.tar.gz: b36786f16696fe52fbc8497792efd5b4cd0da946f205f6d8b5268ef5448416685042a5e2a089117a6d340bd2de7790881c7668cdda842263a26a52d40f5fc9bb
6
+ metadata.gz: d01ded32ecfc55cf562636a86d43d547a5963a5cc2c902bf81899566889b4e5236506d21bcbd46eef7606ae9ea3506ba91a393ebdaa0a38dd0e2ceda36d13f01
7
+ data.tar.gz: 6d77bde7627237ce80058576473ab0062f6bb9c52c197505c5a90da79de782ffe132572e558ef6c73876aa06c4a3f14bab912e79240d205c68801913e7246a3b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- michael_taylor_sdk (1.0.0)
4
+ michael_taylor_sdk (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/design.md ADDED
@@ -0,0 +1,18 @@
1
+ This SDK is designed around a pipeline that transforms an SDK method call
2
+ into an HTTP request and transforms the response into an easy to use result.
3
+ Each pipeline stage is defined under the pipeline directory.
4
+
5
+ Each pipeline stage is designed to have a simple transformation on the input and/or output.
6
+ * paginate add pagination parameters to the input and adds the returned pagination properties into the output
7
+ * filter adds query parameters to the input for queries like name=Movie Name
8
+ * json converts the output from a string to a Ruby Hash by parsing the string as JSON
9
+ * response_body pulls the body from the HTTP response and ensures it is present and not empty
10
+ * set_path adds the path information that will later be appended to the base URL
11
+ * retry runs a retry strategy to attempt to resolve server errors
12
+ * raise_http_errors converts the HTTP response classes into errors for 4XX and 5XX response codes
13
+ * get_request is the final stage that makes the HTTP request
14
+
15
+ The main SDK object has methods that provide access to the API paths. These are defined under the api_paths directory.
16
+ Currently there is just `.movies` but it could be expanded to include other paths like `.books` or `.characters`
17
+ by adding new subclasses of MichaelTaylorSdk::ApiPaths::Base. These subclasses only need to define the main path used
18
+ in the API and any custom queries that abstract away complexity from the user by adding filters or combining related calls.
@@ -27,6 +27,7 @@ module MichaelTaylorSdk::ApiPaths
27
27
  execute_pipeline(paginated_pipeline, {})
28
28
  end
29
29
  end
30
+ raise "Movie named #{name} not found" if movies[:items].empty?
30
31
  matching_movie = movies[:items][0]
31
32
  quotes_from_movie(matching_movie[:_id])
32
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MichaelTaylorSdk
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: michael_taylor_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Taylor
@@ -25,6 +25,7 @@ files:
25
25
  - LICENSE.txt
26
26
  - README.md
27
27
  - Rakefile
28
+ - design.md
28
29
  - lib/michael_taylor_sdk.rb
29
30
  - lib/michael_taylor_sdk/api_paths/all_paths.rb
30
31
  - lib/michael_taylor_sdk/api_paths/base.rb