payload-api 0.2.4 → 0.2.5

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: bbb1f9ed364eb3e8d721aa2e52e3998097e764c5efdb650b7c1ab840b792197d
4
- data.tar.gz: 17e0e956231c7ae5ccfb0c63ca1a50061d4ed1812b7c8871c3d54f38e7254a05
3
+ metadata.gz: 5783328f0a31aea836478841802815c16aaef86b22ff101c698b61603f1437cd
4
+ data.tar.gz: 4e606c81caaec76f7410e7e29c55c77261ae28b2c5b69c9191b62eb297a82d3f
5
5
  SHA512:
6
- metadata.gz: 32dc9421316afd86f9df392613d2f6c4b5ef793c0a82e5256718bf3740408ec3b055f3916d8e9a5c06d792eb5cf589338452dec6b46ad5bf0e14ab15ce8ac81b
7
- data.tar.gz: cd79ebdffa7156488217896c5b6ae37379f9efbe9781cfcdfcd6690ae9acd21eb70c4debabd48bf0e99c45a704303df5702717c510dcfe2c6ffd672efabeed55
6
+ metadata.gz: 5aa4c8bbc4bb6a15feb4473378289b1f9d7c7ea510cca774a77cce4fcc3cd30a7aece820aaabfa5f24c54dd6fc3f09bf9f146955f5e1b05975947f04d1870fc8
7
+ data.tar.gz: 5e7ded315bac9487390cdaa23b18a59770f5f1b3eb1896f99d6a33e270bb3c0906b40e0df22dc58b37c45000564bb78c9def03ff36ecdac909c0667492d83fc7
data/README.md CHANGED
@@ -18,12 +18,10 @@ gem install payload
18
18
 
19
19
  ## Get Started
20
20
 
21
- Once you've installed the Payload Python library to your environment,
22
- import the `payload` module to get started. **Note:** We recommend
23
- using the shorthand name of `pl` when importing.
21
+ Once Payload has been added to your Gemfile and installed, use `require` as shown below to import it into your project.
24
22
 
25
- ```python
26
- import payload as pl
23
+ ```ruby
24
+ require 'payload'
27
25
  ```
28
26
 
29
27
  ### API Authentication
@@ -31,9 +29,9 @@ import payload as pl
31
29
  To authenticate with the Payload API, you'll need a live or test API key. API
32
30
  keys are accessible from within the Payload dashboard.
33
31
 
34
- ```python
35
- import payload as pl
36
- pl.api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE'
32
+ ```ruby
33
+ require 'payload'
34
+ Payload.api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE'
37
35
  ```
38
36
 
39
37
  ### Creating an Object
@@ -10,6 +10,7 @@ module Payload
10
10
 
11
11
  def initialize(cls=nil)
12
12
  @cls = cls
13
+ @selected_fields = ''
13
14
  @filters = {}
14
15
  end
15
16
 
@@ -17,7 +18,9 @@ module Payload
17
18
  if @cls.poly
18
19
  data = data.merge(@cls.poly)
19
20
  end
20
-
21
+
22
+ @selected_fields = args.join(',')
23
+
21
24
  return self
22
25
  end
23
26
 
@@ -84,6 +87,14 @@ module Payload
84
87
  end
85
88
 
86
89
  def _request(method, id: nil, json: nil)
90
+
91
+ # Update @filters['fields'] with @selected_fields
92
+ fields_list = []
93
+ fields_list << @filters['fields'] if @filters['fields'] && !@filters['fields'].empty?
94
+ fields_list << @selected_fields if @selected_fields && !@selected_fields.empty?
95
+ @filters['fields'] = fields_list.join(',') if fields_list.any?
96
+ @filters['fields'] ||= '*'
97
+
87
98
  if @cls.spec.key?("endpoint")
88
99
  endpoint = @cls.spec["endpoint"]
89
100
  else
@@ -1,3 +1,3 @@
1
1
  module Payload
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payload-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Payload
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple library to interface with the Payload API. See https://docs.payload.co
14
14
  for details.