usps-imis-api 0.11.5 → 0.11.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8e2923d6da2cf2d2fbfd60e2b29e6930efb66148bebd9746521454d64786106
4
- data.tar.gz: d4a8927801796b0a09a7ec2f1f1dd6c702e7785d6fb39d699d4f9f622e2be9d2
3
+ metadata.gz: 67535b48ce969a401d19d573ba5b1557fac0dfa971dddacf9345a0c1c365486f
4
+ data.tar.gz: 6c39e4c4f3276f8bd26a317c2c96ebf0be2561998d5b3cfecc3ebdefd27d6328
5
5
  SHA512:
6
- metadata.gz: 1a69f233aca63d00f441fe6d044ba4206bce8aa309f3eb96ae05f07477585737a044a092dc7234f9d83c505fc14e1c8834dacadc4bfce5560efe4f42ee92ea5e
7
- data.tar.gz: d44e7298e69c825349194ff24338bcf74494b1e641dd6c3c4e2d05e68b530b959cbb435d84ecf39fb8da4b54b2097858c8c8479e5b3aad6491facdb51eca8b4c
6
+ metadata.gz: 4c9fa38439583904701cfbd42aaad35e9b1affae85fb15eaf94237641380462df353aaa25b93ec901e633ef37b8ee88af5e55928cb560a2ec273484fcb79b731
7
+ data.tar.gz: f321eaf91b434b4bfa15279cab97fbf9d2c7f0d9d54094f6987de69742ea1927d0f5f93bd6206a458316cb99dc02222c7e030780b4a09dfede70d174b34b865d
@@ -64,26 +64,26 @@ module Usps
64
64
 
65
65
  # rubocop:disable Metrics
66
66
  def perform!
67
- case options
67
+ case convert(options)
68
+ in mapper: true, field:, data: then api.mapper[field.to_sym] = data
69
+ in mapper: true, field: then api.mapper[field.to_sym]
68
70
  in mapper: true, data: then api.mapper.update(data)
69
- in map:, data: then api.mapper[map.to_sym] = data
70
- in map: then api.mapper[map.to_sym]
71
-
72
- in on:, delete: true then api.on(on).delete
73
- in on:, data:, post: true then api.on(on).post(data)
74
- in on:, data:, field: then api.on(on).put_field(field, data)
75
- in on:, data: then api.on(on).put_fields(data)
76
- in on:, fields: then api.on(on).get_fields(*fields)
77
- in on:, field: then api.on(on).get_field(field)
78
- in on: then api.on(on).get
79
-
80
- in panel:, ordinal:, delete: true then api.panels.public_send(panel).delete(ordinal)
81
- in panel:, data:, post: true then api.panels.public_send(panel).post(data)
82
- in panel:, ordinal:, data:, field: then api.panels.public_send(panel).put_field(ordinal, field, data)
83
- in panel:, ordinal:, data: then api.panels.public_send(panel).put_fields(ordinal, data)
84
- in panel:, ordinal:, fields: then api.panels.public_send(panel).get_fields(ordinal, *fields)
85
- in panel:, ordinal:, field: then api.panels.public_send(panel).get_field(ordinal, field)
86
- in panel:, ordinal: then api.panels.public_send(panel).get(ordinal)
71
+
72
+ in on:, delete: true then on.delete
73
+ in on:, post: true, data: then on.post(data)
74
+ in on:, data:, field: then on.put_field(field, data)
75
+ in on:, data: then on.put_fields(data)
76
+ in on:, fields: then on.get_fields(*fields)
77
+ in on:, field: then on.get_field(field)
78
+ in on: then on.get
79
+
80
+ in panel:, delete: true, ordinal: then panel.delete(ordinal)
81
+ in panel:, post: true, data: then panel.post(data)
82
+ in panel:, ordinal:, data:, field: then panel.put_field(ordinal, field, data)
83
+ in panel:, ordinal:, data: then panel.put_fields(ordinal, data)
84
+ in panel:, ordinal:, fields: then panel.get_fields(ordinal, *fields)
85
+ in panel:, ordinal:, field: then panel.get_field(ordinal, field)
86
+ in panel:, ordinal: then panel.get(ordinal)
87
87
 
88
88
  in query:, data: then api.query(query, data)
89
89
  in query: then api.query(query)
@@ -93,6 +93,18 @@ module Usps
93
93
  end
94
94
  # rubocop:enable Metrics
95
95
 
96
+ def convert(options)
97
+ options.dup.tap do |converted|
98
+ case converted
99
+ in map: then converted.merge!(mapper: true, field: map)
100
+ in on: then converted[:on] = api.on(on)
101
+ in panel: then converted[:panel] = api.panels.public_send(panel)
102
+ else
103
+ # Nothing to convert
104
+ end
105
+ end
106
+ end
107
+
96
108
  def simplify(data)
97
109
  return data.to_a if data.is_a?(Query)
98
110
  return data if options[:raw]
@@ -17,8 +17,8 @@ module Usps
17
17
  delete: ["Send a #{'DELETE'.cyan} request", { short: :D }],
18
18
  field: ['Specific field to return or update', { type: :string }],
19
19
  fields: ['Specific field(s) to return', { type: :strings, short: :F }],
20
- map: ['Mapped field name to return or update', { type: :string }],
21
- mapper: ['Multiple mapped fields to update together', { short: :M }],
20
+ map: ['Shorthand for accessing a single mapped field', { type: :string }],
21
+ mapper: ['Interact with mapped fields', { short: :M }],
22
22
  data: ['JSON string input', { type: :string }],
23
23
  config: ['Path to the JSON config file to use', { type: :string, short: :C }],
24
24
  raw: ['Return raw JSON output, rather than simplified data', { short: :R }],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.11.5'
5
+ VERSION = '0.11.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-imis-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander