bottle_service 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
  SHA1:
3
- metadata.gz: 5dfa858874d43209d28614f5e6e1b719278e7e47
4
- data.tar.gz: 0621db9058691d4ceacd0e40178f043eb2932978
3
+ metadata.gz: 2b2177887de0a1595cafa42aac62df1f25c45922
4
+ data.tar.gz: ee6c78025b10ff84e0440fd2b8ea8fcb30eac5ec
5
5
  SHA512:
6
- metadata.gz: a064f9848f4ef75f14d3ed38485d5794822a15468affd1760667822656188a259ca9df1879166aa4a3443e74394c11acd9e643a4f8a888c9040ba1f8f54495e1
7
- data.tar.gz: b0b76708e098ed995ee78e3fc192127ff0a5b13dc55dfc35aeab96585e79768a148844da96449719a52e9d0ce2792ba503203c3525a4455243cd8a8515913833
6
+ metadata.gz: 22d0620fbc90a43db67c5f5958f9c41a4211d5b42aafacd00da75261a939dbb6b0321fc3b865339f67a8643bcc1f3087025d57110d33b821b9e96bbba1aac9a1
7
+ data.tar.gz: b23d27b35118227c1704182f04cd7677a0e081450d3441bfe08650a89fd73e408e4bd042f963d8bdcfcec1ddb29f6c877a978fda612b43e867032124e4700b62
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ### BottleService
2
2
 
3
- # Installation
3
+ #### Installation
4
4
 
5
5
  ``` terminal
6
6
  $ gem install bottle_service
@@ -12,12 +12,12 @@ or in your **Gemfile**
12
12
  gem "bottle_service"
13
13
  ```
14
14
 
15
- # Use
15
+ #### Usage
16
16
 
17
- #### Simple example
17
+ ##### Simple example
18
18
 
19
19
  ``` ruby
20
- class Greeter < BottleService
20
+ class Greeter < BottleService::Waitress
21
21
  attribute :name, String
22
22
 
23
23
  def call
@@ -29,45 +29,3 @@ Greeter.call name: "Space" # Hello Space!
29
29
  # or
30
30
  Greeter.(name: "Space") # Hello Space!
31
31
  ```
32
-
33
- #### Extended example
34
-
35
- ``` ruby
36
- class CreateProduct < BottleService
37
- attribute :shop, Shop
38
- attribute :name, String
39
- attribute :price_cents, Integer
40
- attribute :tax_percentage, Float
41
- attribute :tags, Array[Tag]
42
-
43
- def call
44
- product = @shop.products.create name: @name,
45
- price_cents: @price_cents,
46
- tax_cents: calculate_tax
47
-
48
- raise BottleServiceError, "Failed to save product" unless product.persisted?
49
-
50
- add_tags_to_product(product)
51
-
52
- product
53
- end
54
-
55
- private
56
-
57
- def calculate_tax
58
- @price_cents / (1 + (@tax_percentage / 100))
59
- end
60
-
61
- def add_tags_to_product(product)
62
- @tags.each do |tag|
63
- product.append tag
64
- end
65
- end
66
- end
67
-
68
- CreateProduct.call shop: current_shop,
69
- name: "Awesome T-Shirt",
70
- price: 2000,
71
- tax: 21.0,
72
- tags: tags
73
- ```
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module BottleService
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bottle_service
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
  - Henricus Louwhoff