passworks 2.0.2 → 2.0.3

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: a01901fb5bd0f809db6d23577640f39308d893aa
4
- data.tar.gz: 8f423a398e1b7bd502076cc20b9376ae7f5975a2
3
+ metadata.gz: 4d7e2ee6c6e59b1cf631ac126267597f58b56cf2
4
+ data.tar.gz: e2630db18d08ea6abbb0c24a303f52b601bf404a
5
5
  SHA512:
6
- metadata.gz: 03057761c29430d3599053ef6fd96d69a6229f2b57e0c3280bfe8384b287a4a38717058482181e4da97ddf7994c3f59f16a8803d7fd6ca8d46002a505d65870f
7
- data.tar.gz: 734df083da0e114e9f36fc78b5910bfa390b42fb29b2f4594e7c578c23d4794970ed2fb5aa01216d52d4f254a900af944b786c2f6dfd450eb1833718b23baaa3
6
+ metadata.gz: a1db6971e9502f7197a81f6ab04aabbd71e82a0fa6fe79fc1b897d21e0ceb15592b2290f571704e5bbf8c6de4493b4b0bc9bf230e6cf2bbefeec37301b69940e
7
+ data.tar.gz: 8e0c103e7bc590ef274ef4b0b2c56c653e98a74f2fb13e0caff38b9074c303b1fb2b3d009b86b8154f96ef074bf49cdfe93d9c0af7483e644c7e3c50f24d307b
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  This file is a manually maintained list of changes for each release. Feel free to add your
4
4
  changes here when sending pull requests. Also send corrections if you spot any mistakes.
5
5
 
6
+ ## v2.0.3 (2015-12-09)
7
+ * Added campaign resource's merge call, for propagating campaign pass data changes
8
+ to all of it's passes.
9
+
6
10
  ## v2.0.2 (2015-12-01)
7
11
  * Fixing collection_uuid on PassResource
8
12
 
data/README.md CHANGED
@@ -40,8 +40,8 @@ client = Passworks.new
40
40
  ```ruby
41
41
  # Instance level configuration
42
42
  client = Passworks.new({
43
- api_username: 'your api username',
44
- api_secret: 'your api secret'
43
+ api_username: 'your api username',
44
+ api_secret: 'your api secret'
45
45
  })
46
46
  ```
47
47
 
@@ -49,6 +49,10 @@ client = Passworks.new({
49
49
 
50
50
  ### Certificates
51
51
 
52
+ Certificates are an essential part of every campaign.
53
+
54
+ They're used to uniquely identify a certain person or organization, and offer authenthicity reasurance. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/certificates.md#certificates) for mode information.
55
+
52
56
  ```ruby
53
57
  # Fetch and iterate through all your certificates
54
58
  certificates = client.certificates.all
@@ -62,6 +66,10 @@ certificate = client.certificates.find('c3d5fc64-3a43-4d3a-a167-473dfeb1edd3')
62
66
 
63
67
  ### Assets
64
68
 
69
+ Assets are the visual elements of the pass.
70
+
71
+ You can reuse assets, meaning that you can assign the same asset to multiple passes, reducing the number of asset operations and also reducing the amount of bandwidth required to create a pass. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/assets.md#assets) for mode information.
72
+
65
73
  ```ruby
66
74
  # Upload an asset (icon image)
67
75
  asset_icon = client.assets.create({ file: '/path-to-file/icon-file.png', asset_type: 'icon' })
@@ -84,6 +92,8 @@ asset.delete
84
92
 
85
93
  ### Coupons
86
94
 
95
+ Coupons can be used to offer customers a discount or promotion, or as a general proximity marketing asset. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/coupon.md) for mode information.
96
+
87
97
  ```ruby
88
98
  # Create a coupon campaign
89
99
  coupon_campaign = client.coupons.create({
@@ -131,6 +141,9 @@ updated_coupon_pass = coupon_pass.update({
131
141
 
132
142
  ### Store Cards
133
143
 
144
+ The Passworks API can be used to create loyalty or event tier programs to reward your customers for using your services. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/store_card.md) for mode information.
145
+
146
+
134
147
  ```ruby
135
148
  # Create a store card campaign
136
149
  coupon_campaign = client.store_cards.create({
@@ -178,6 +191,8 @@ updated_coupon_pass = store_card_pass.update({
178
191
 
179
192
  ### Event Tickets
180
193
 
194
+ Event Tickets are passes used for events such as concerts, movie tickets, galas, meetings or other types of activity that happen in a specific time or day. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/event_ticket.md) for mode information.
195
+
181
196
  ```ruby
182
197
  # Create a event ticket campaign
183
198
  event_ticket_campaign = client.event_tickets.create({
@@ -225,6 +240,9 @@ updated_event_ticket_pass = event_ticket_pass.update({
225
240
 
226
241
  ### Bording Passes
227
242
 
243
+ Boarding passes can be airplane, bus, train, or boat tickets. You also can create generic boarding passes. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/boarding_pass.md) for mode information.
244
+
245
+
228
246
  ```ruby
229
247
  # Create a boarding pass campaign
230
248
  boarding_pass_campaign = client.boarding_passes.create({
@@ -273,6 +291,8 @@ updated_boarding_pass_pass = boarding_pass_pass.update({
273
291
 
274
292
  ### Generic
275
293
 
294
+ Generic passes can be used for anything that doesn't fit in the other pass categories. [See Passworks API](https://github.com/passworks/passworks-api/blob/master/v2/sections/generic.md) for mode information.
295
+
276
296
  ```ruby
277
297
  # Create a generic pass campaign
278
298
  generic_campaign = client.boarding_passes.create({
@@ -318,6 +338,53 @@ updated_generic_pass = generic_pass.update({
318
338
  })
319
339
  ```
320
340
 
341
+ ## Updating campaign passes in a single request
342
+
343
+ It's possible to update the passes presentation fields (`primary_fields`, `secondary_fields`, `auxiliary_fields` and `back_fields`) using the Campaign data in a single request.
344
+
345
+ For that you only need to follow the 2 steps:
346
+
347
+ 1. Update the campaign with the intended information.
348
+ 2. Call the `merge` method in the campaign, this method merges the presentation fields of the campaign with the passes information.
349
+
350
+ ```ruby
351
+ # Find the campaign that you wish to update
352
+ campaign = client.coupons.find("c3d5fc64-3a43-4d3a-a167-473dfeb1edd3")
353
+
354
+ # Update the campaign
355
+ campaign.update({
356
+ secondary_fields: [
357
+ {
358
+ key: "date",
359
+ label: "Promotion expires at",
360
+ value: "31/12/2015"
361
+ }
362
+ ]
363
+ })
364
+
365
+ # Update the campaign passes
366
+ campaign.merge
367
+ ```
368
+
369
+
370
+ > IMPORTANTE: This method updates all passes `beacons` and `locations` (geo locations) with the Campaign defined ones, overriding the existing in the passes.
371
+
372
+
373
+ ## Understanding behaviour fields (fixed vs dynamic content)
374
+
375
+ The presentation fields (`primary_fields`, `secondary_fields`, `auxiliary_fields` and `back_fields`) have a new (`behaviour`) attribute. This attribute can have one of two values: `fixed` or `dynamic` _(by default the `behaviour` is set to `fixed`)_.
376
+
377
+ - fixed
378
+
379
+ `fixed` means that the value is `static`: every pass will have the same `label` and `value` for this field.
380
+ So when you call the `merge` method in the Ruby client this field will be added or overriden (if the field with the same `key` exists) in every pass even if you had previously customized the value per pass. Don't use the type of field for custom fields in your passes eg: __name__, __client id__, __ticket number__ ,etc. This type of _behaviour_ is a good fit for fields that are the same across all passes eg: `event date`, `event location`, `flight number`, etc.
381
+
382
+ - dynamic
383
+
384
+ The `dynamic` _behaviour_ defines the field as a custom updated field that shouldn't be updated on a bulk update when the `merge` method is called.
385
+ This field will only be updated when the user updates that field specifically for that pass. This type of _behaviour_ is a good fit for custom fields like `ticket number`, `user name`, `boarding number`, `seat number`, etc..
386
+
387
+
321
388
  ## Documentation
322
389
 
323
390
  For more information about the API please please refere to [https://github.com/passworks/passworks-api](https://github.com/passworks/passworks-api)
@@ -23,6 +23,13 @@ module Passworks
23
23
  client.post("#{collection_name}/#{id}/push").ok?
24
24
  end
25
25
 
26
+ # Merges all campaign data changes into the passes using the PassUpdater
27
+ # /lib/ in the main backend-saas project.
28
+ # @return [Boolean]
29
+ def merge
30
+ client.post("#{collection_name}/#{id}/merge").ok?
31
+ end
32
+
26
33
  # Updates the {CampaignResource} and returns the updated instance
27
34
  # @return [CampaignResource] Updated instance
28
35
  def update(data, params={})
@@ -1,3 +1,3 @@
1
1
  module Passworks
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Mendes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-01 00:00:00.000000000 Z
13
+ date: 2015-12-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -240,3 +240,4 @@ test_files:
240
240
  - spec/support/.DS_Store
241
241
  - spec/support/assets/logo.png
242
242
  - spec/support/vcr_setup.rb
243
+ has_rdoc: