citrix 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: a5a06b3c6f0dc327a0bcbcd906dd5348a55dd998
4
- data.tar.gz: 32d47b27842f60d00284619696f908da9df02e9a
3
+ metadata.gz: 202698e1982c4eef3b771e757d37ce8f4e759b3e
4
+ data.tar.gz: a9feb13e4be7315947e8842af036a2f992ab8fbc
5
5
  SHA512:
6
- metadata.gz: 3406b08706191fde2506c2fd55d95fcb59111627ea91031fa82190b59a44a5a1a7b776a43a8f27edcdda47eb0188378e937b4ba560876012d6b1079d90e2204f
7
- data.tar.gz: a42202ff1e877baea7d5da52558eaf54184da3524d595865f12e197a14d3c019415c69a119137544256461e7a8de0afbb476a7e1ef860a5826d10c13b863671c
6
+ metadata.gz: 0d682457accf3034894bc1927a46ea7262af587f796c78bf1b8d7999e406332984b22429b609941603e1dfc108b59a03a3a10d3c82a822b7ee2df48cf88c4035
7
+ data.tar.gz: 8baf578f08483877dec153cdd70f0da6293bfc671e5d05266d25e77f6d4988ed41b6ef36fefed9fd99bcd64a8cc67fc5ecdea060a209f729aee570ccba6ff7e6
File without changes
data/README.md CHANGED
@@ -10,7 +10,9 @@ API wrappers for Citrix services like GoToTraining. It includes partial API mapp
10
10
 
11
11
  Add this line to your application's Gemfile:
12
12
 
13
- gem 'citrix'
13
+ ```ruby
14
+ gem 'citrix'
15
+ ```
14
16
 
15
17
  And then execute:
16
18
 
@@ -72,6 +74,20 @@ else
72
74
  end
73
75
  ```
74
76
 
77
+ #### Get training
78
+
79
+ Retrieve information on a given scheduled training for a given organizer.
80
+
81
+ ```ruby
82
+ response, training = client.trainings.find(training_key)
83
+
84
+ if training
85
+ # Do something with training
86
+ else
87
+ p response.json
88
+ end
89
+ ```
90
+
75
91
  #### Remove a training
76
92
 
77
93
  Deletes a scheduled or completed training.
@@ -69,6 +69,18 @@ module Citrix
69
69
  [response, trainings]
70
70
  end
71
71
 
72
+ # Find a scheduled or completed training by its key.
73
+ def find(key)
74
+ url = url_for('organizers', credentials.organizer_key, 'trainings', key)
75
+ response = http_client.get(url)
76
+
77
+ if response.ok?
78
+ training = Resource::Training.new Resource::Training.deserialize(response.json)
79
+ end
80
+
81
+ [response, training]
82
+ end
83
+
72
84
  # Deletes a scheduled or completed training.
73
85
  #
74
86
  # For scheduled trainings, it deletes all scheduled sessions of the
@@ -1,3 +1,3 @@
1
1
  module Citrix
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -60,6 +60,30 @@ describe Citrix::Training::Namespace::Trainings do
60
60
  end
61
61
  end
62
62
 
63
+ describe '#find' do
64
+ let(:client) { build_client }
65
+
66
+ it 'performs request' do
67
+ stub_request(:get, /.+/)
68
+ .to_return(status: 200, body: fixtures.join('training.json').read, headers: {'Content-Type' => 'application/json'})
69
+ client.trainings.find('1234')
70
+
71
+ url = url_for('organizers', client.credentials.organizer_key, 'trainings', '1234')
72
+
73
+ expect(last_request.method).to eq(:get)
74
+ expect(last_request.uri.normalize.to_s).to eq(url)
75
+ end
76
+
77
+ it 'returns training' do
78
+ stub_request(:get, /.+/)
79
+ .to_return(status: 200, body: fixtures.join('training.json').read, headers: {'Content-Type' => 'application/json'})
80
+
81
+ response, training = client.trainings.find('1234')
82
+
83
+ expect(training).to be_a(Citrix::Training::Resource::Training)
84
+ end
85
+ end
86
+
63
87
  describe '#remove' do
64
88
  let(:client) { build_client }
65
89
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-21 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aitch
@@ -119,7 +119,7 @@ files:
119
119
  - ".rspec"
120
120
  - ".travis.yml"
121
121
  - CHANGELOG.md
122
- - CONTRIBUITING.md
122
+ - CONTRIBUTING.md
123
123
  - Gemfile
124
124
  - LICENSE.md
125
125
  - README.md
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
- rubygems_version: 2.2.2
180
+ rubygems_version: 2.4.5
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: API wrappers for Citrix services like GoToTraining.