passdock 0.1.5 → 0.1.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.
Files changed (5) hide show
  1. data/README.md +23 -11
  2. data/Rakefile +1 -1
  3. data/lib/passdock.rb +8 -8
  4. data/passdock.gemspec +3 -3
  5. metadata +3 -3
data/README.md CHANGED
@@ -10,8 +10,9 @@ This sample code requires *httparty*.
10
10
  Use
11
11
 
12
12
  gem install httparty
13
+ gem install passdock
13
14
 
14
- to istall them.
15
+ to install them.
15
16
 
16
17
  ### Get your authentication token
17
18
 
@@ -19,9 +20,20 @@ You need to register on [api.passdock.com](https://api.passdock.com) and get an
19
20
 
20
21
  ### Let's start
21
22
 
22
- Once obtained you can create a new istance of the Passdock object.
23
+ Require the gems
23
24
 
24
- passdock = Passdock.new("YOUR_TOKEN")
25
+ require 'httparty'
26
+ require 'passdock'
27
+ require 'pp'
28
+
29
+ Once obtained you can create a new istance of the Passdock object and set the API key.
30
+
31
+ Passdock.api_key = "YOUR_TOKEN"
32
+
33
+ To get the templates as json use
34
+
35
+ pp = Passdock.templates
36
+
25
37
 
26
38
  Then you can call some methods to get the desired informations out of Passdock or to create new Passes.
27
39
 
@@ -33,48 +45,48 @@ To get started just add one of the following line, appropriately modified at the
33
45
 
34
46
  Get all your templates for your account
35
47
 
36
- pp passdock.templates
48
+ pp Passdock.templates
37
49
 
38
50
  #### Get a Template
39
51
 
40
52
  Pass the id of the template as argument
41
53
 
42
- pp passdock.template(82)
54
+ pp Passdock.template(82)
43
55
 
44
56
  #### Destroy a Template
45
57
 
46
58
  The first argument is the template id, the second one if you want exanded errors.
47
59
 
48
- pp passdock.destroy_template(82, true)
60
+ pp Passdock.destroy_template(82, true)
49
61
 
50
62
  #### Get a Pass
51
63
 
52
64
  The first parameter is the Pass ID, the second its template ID
53
65
 
54
- pp passdock.pass(132, 82)
66
+ pp Passdock.pass(132, 82)
55
67
 
56
68
  #### Create a Pass
57
69
 
58
70
  The first argument is the a JSON jash containing the Pass structure, more informations on [api.passdock.com/doc](https://api.passdock.com/doc).
59
71
  The second argument is the template id, the third one if you want debug informations and the last one exanded errors.
60
72
 
61
- pp passdock.create_pass('{"serial_number":"1234", "gate":"12"}', 82, true, false)
73
+ pp Passdock.create_pass('{"serial_number":"1234", "gate":"12"}', 82, true, false)
62
74
 
63
75
  #### Update a Pass
64
76
 
65
77
  The first argument is the a JSON jash containing the Pass structure, more informations on [api.passdock.com/doc](https://api.passdock.com/doc).
66
78
  The second argument is the template id, the third one if you want debug informations and the last one exanded errors.
67
79
 
68
- pp passdock.update_pass('{"serial_number":"5678", "gate":"15"}', 94, 82, true, false)
80
+ pp Passdock.update_pass('{"serial_number":"5678", "gate":"15"}', 94, 82, true, false)
69
81
 
70
82
  #### Download a Pass
71
83
 
72
84
  The first parameter is the Pass ID, the second its template ID
73
85
 
74
- pp passdock.download_pass(82, 82)
86
+ pp Passdock.download_pass(82, 82)
75
87
 
76
88
  #### Destroy a Pass
77
89
 
78
90
  The first argument is the template id, the second one if you want exanded errors.
79
91
 
80
- pp passdock.destroy_pass(94, 82, true)
92
+ pp Passdock.destroy_pass(94, 82, true)
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('passdock', '0.1.5') do |p|
5
+ Echoe.new('passdock', '0.1.6') do |p|
6
6
  p.description = "Talk with Passdock API"
7
7
  p.url = "http://github.com/Creapptor/passdock-ruby"
8
8
  p.author = "Creapptor S.A."
@@ -22,11 +22,11 @@ module Passdock
22
22
  end
23
23
 
24
24
  def self.templates
25
- self.get("#{@@api_base}/templates?api_token=#{@@api_key}")
25
+ self.get("#{@@api_base}/templates.json?api_token=#{@@api_key}")
26
26
  end
27
27
 
28
28
  def self.template(id)
29
- self.get("#{@@api_base}/templates/#{id}?api_token=#{@@api_key}")
29
+ self.get("#{@@api_base}/templates/#{id}.json?api_token=#{@@api_key}")
30
30
  end
31
31
 
32
32
  def self.destroy_template(family_id, errors)
@@ -37,15 +37,15 @@ module Passdock
37
37
  :api_token => @@api_key
38
38
  }
39
39
  }
40
- self.delete("#{@@api_base}/templates/#{family_id}", options)
40
+ self.delete("#{@@api_base}/templates/#{family_id}.json", options)
41
41
  end
42
42
 
43
43
  def self.pass(pass_id, family_id)
44
- self.get("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}?api_token=#{@@api_key}")
44
+ self.get("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}.json?api_token=#{@@api_key}")
45
45
  end
46
46
 
47
47
  def self.download_pass(pass_id, family_id)
48
- self.get("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}?api_token=#{@@api_key}&show=true")
48
+ self.get("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}.json?api_token=#{@@api_key}&show=true")
49
49
  end
50
50
 
51
51
  def self.create_pass(pass, family_id, debug, errors)
@@ -59,7 +59,7 @@ module Passdock
59
59
  :pass => pass
60
60
  }
61
61
  }
62
- self.post("#{@@api_base}/templates/#{family_id}/passes", options)
62
+ self.post("#{@@api_base}/templates/#{family_id}/passes.json", options)
63
63
  end
64
64
 
65
65
  def self.update_pass(pass, pass_id, family_id, debug, errors)
@@ -73,7 +73,7 @@ module Passdock
73
73
  :pass => pass
74
74
  }
75
75
  }
76
- self.put("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}", options)
76
+ self.put("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}.json", options)
77
77
  end
78
78
 
79
79
  def self.destroy_pass(pass_id, family_id, errors)
@@ -84,6 +84,6 @@ module Passdock
84
84
  :api_token => @@api_key
85
85
  }
86
86
  }
87
- self.delete("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}", options)
87
+ self.delete("#{@@api_base}/templates/#{family_id}/passes/#{pass_id}.json", options)
88
88
  end
89
89
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "passdock"
5
- s.version = "0.1.5"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Creapptor S.A."]
9
- s.date = "2012-09-19"
9
+ s.date = "2013-02-08"
10
10
  s.description = "Talk with Passdock API"
11
11
  s.email = "info@creapptor.com"
12
12
  s.extra_rdoc_files = ["README.md", "lib/passdock.rb"]
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Passdock", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = "passdock"
18
- s.rubygems_version = "1.8.24"
18
+ s.rubygems_version = "1.8.23"
19
19
  s.summary = "Talk with Passdock API"
20
20
 
21
21
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passdock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-19 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Talk with Passdock API
15
15
  email: info@creapptor.com
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  version: '1.2'
51
51
  requirements: []
52
52
  rubyforge_project: passdock
53
- rubygems_version: 1.8.24
53
+ rubygems_version: 1.8.23
54
54
  signing_key:
55
55
  specification_version: 3
56
56
  summary: Talk with Passdock API