pragma 1.0.0 → 1.1.0

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: 174ff0a19183fd8143744ce6875bb02862c4e331
4
- data.tar.gz: dcdd63d38b1d702b1bc97c9084c0a363b95f4460
3
+ metadata.gz: 50ba068f5b924005a5e8f4d9c33c6e2bd125c418
4
+ data.tar.gz: 43ca9b386e7f1a6ad34324dc15f05d8e267a7416
5
5
  SHA512:
6
- metadata.gz: 5fc0393bcbf4addd38581ad14d43874932642789f1f9a76f310589eaeb8c4d3145fa54d13fbee912442643f38e088030e9efabdf14708ca0317f585a517977e8
7
- data.tar.gz: 117bca00c24dd2fbe3c1eb34f53ab46a9dc611bb8d788e1048d05e6d07ab359d0dea99b72237033970a5d65151c5d4b659c3ed5d0578c4d45904f60776fe3ed8
6
+ metadata.gz: 67ef8ff72decf2fbb18dc94bbbcac24b377215e73400cf3c70262f3c25db4d3ba58cd6965ae380c02a26e36eb2a95f035c24ddecfe8474685a209625e7428362
7
+ data.tar.gz: 4f7b4500ad0ab5a832f583d1f23eeccc66c3075f579ee16b41d5f524b85e85c7e6290273aaff1572ca3a336fa021fbb55e6205b3e202209664fa01668b7953a8
@@ -9,15 +9,15 @@ module Pragma
9
9
  include Pragma::Operation::Defaults
10
10
 
11
11
  def call
12
- record = build_record
13
- contract = build_contract(record)
12
+ context.record = build_record
13
+ context.contract = build_contract(context.record)
14
14
 
15
- validate! contract
16
- authorize! contract
15
+ validate! context.contract
16
+ authorize! context.contract
17
17
 
18
- contract.save
18
+ context.contract.save
19
19
 
20
- respond_with status: :created, resource: decorate(record)
20
+ respond_with status: :created, resource: decorate(context.record)
21
21
  end
22
22
 
23
23
  protected
@@ -8,10 +8,10 @@ module Pragma
8
8
  include Pragma::Operation::Defaults
9
9
 
10
10
  def call
11
- record = find_record
12
- authorize! record
11
+ context.record = find_record
12
+ authorize! context.record
13
13
 
14
- record.destroy!
14
+ context.record.destroy!
15
15
 
16
16
  head :no_content
17
17
  end
@@ -9,21 +9,21 @@ module Pragma
9
9
  include Pragma::Operation::Defaults
10
10
 
11
11
  def call
12
- records = authorize_collection(find_records)
13
- records = records.paginate(page: page, per_page: per_page)
12
+ context.records = authorize_collection(find_records)
13
+ context.records = context.records.paginate(page: page, per_page: per_page)
14
14
 
15
15
  respond_with(
16
- resource: decorate(records),
16
+ resource: decorate(context.records),
17
17
  headers: {
18
- 'Page' => records.current_page.to_i,
19
- 'Per-Page' => records.per_page,
20
- 'Total' => records.total_entries
18
+ 'Page' => context.records.current_page.to_i,
19
+ 'Per-Page' => context.records.per_page,
20
+ 'Total' => context.records.total_entries
21
21
  },
22
22
  links: {
23
23
  first: build_page_url(1),
24
- last: build_page_url(records.total_pages),
25
- next: (build_page_url(records.next_page) if records.next_page),
26
- prev: (build_page_url(records.previous_page) if records.previous_page)
24
+ last: build_page_url(context.records.total_pages),
25
+ next: (build_page_url(context.records.next_page) if context.records.next_page),
26
+ prev: (build_page_url(context.records.previous_page) if context.records.previous_page)
27
27
  }
28
28
  )
29
29
  end
@@ -8,10 +8,10 @@ module Pragma
8
8
  include Pragma::Operation::Defaults
9
9
 
10
10
  def call
11
- record = find_record
12
- authorize! record
11
+ context.record = find_record
12
+ authorize! context.record
13
13
 
14
- respond_with resource: decorate(record)
14
+ respond_with resource: decorate(context.record)
15
15
  end
16
16
 
17
17
  protected
@@ -9,15 +9,15 @@ module Pragma
9
9
  include Pragma::Operation::Defaults
10
10
 
11
11
  def call
12
- record = find_record
13
- contract = build_contract(record)
12
+ context.record = find_record
13
+ context.contract = build_contract(context.record)
14
14
 
15
- validate! contract
16
- authorize! contract
15
+ validate! context.contract
16
+ authorize! context.contract
17
17
 
18
- contract.save
18
+ context.contract.save
19
19
 
20
- respond_with resource: decorate(record)
20
+ respond_with resource: decorate(context.record)
21
21
  end
22
22
 
23
23
  protected
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Pragma
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-12 00:00:00.000000000 Z
11
+ date: 2017-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pragma-operation