camdram 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/camdram/http.rb +9 -2
- data/lib/camdram/organisation.rb +10 -0
- data/lib/camdram/venue.rb +10 -0
- data/lib/camdram/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23e86b26ba2581784fe9151cbef3425c74cfee15506e83e92c6075392c0cda9c
|
4
|
+
data.tar.gz: 8544d8b711f347904b3032b3522b8c4d2bbbac324696d3fee42722156e905fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd89b4483459a1731771f444659b8c8e29ed512c21665d348f58e0e2fad5c884364ba55356bc84c9fddee2edee93114c3f83339830d13fc79ddcdfbb9cfcae96
|
7
|
+
data.tar.gz: e98b40645e0589893ae4648e56d42dddc4a31d4d30dcc0a93784a0713caff24c8397068b4bda65874a99b0d7c6a802aa6d0610052bccaa53aed4413706580bbe
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
## Documentation
|
18
18
|
Full documentation is generated from the source code by [YARD](https://yardoc.org) and is available to view on
|
19
|
-
[RubyDocs](https://www.rubydoc.info/
|
19
|
+
[RubyDocs](https://www.rubydoc.info/gems/camdram).
|
20
20
|
|
21
21
|
## Usage Examples
|
22
22
|
Just some of the things you can do after configuring a `client` object:
|
@@ -63,7 +63,7 @@ As a result of this policy, you can (and should) specify a dependency on this ge
|
|
63
63
|
[Pessimistic Version Constraint](http://guides.rubygems.org/patterns/#pessimistic-version-constraint) with two digits of precision.
|
64
64
|
For example:
|
65
65
|
```ruby
|
66
|
-
spec.add_runtime_dependency 'camdram', '~> 1.
|
66
|
+
spec.add_runtime_dependency 'camdram', '~> 1.2'
|
67
67
|
```
|
68
68
|
|
69
69
|
## Copyright
|
data/lib/camdram/http.rb
CHANGED
@@ -27,6 +27,13 @@ module Camdram
|
|
27
27
|
!@api_token.nil? && !(blank?(@api_token))
|
28
28
|
end
|
29
29
|
|
30
|
+
# Returns true if the User Agent string is set
|
31
|
+
#
|
32
|
+
# @return [Boolean] Whether the User Agent string is set or not.
|
33
|
+
def user_agent?
|
34
|
+
!@user_agent.nil? && !(blank?(@user_agent))
|
35
|
+
end
|
36
|
+
|
30
37
|
# Returns the API URL that each HTTP request is sent to
|
31
38
|
#
|
32
39
|
# @return [String] The API hostname to send requests to.
|
@@ -59,8 +66,8 @@ module Camdram
|
|
59
66
|
|
60
67
|
response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) {|http|
|
61
68
|
request = Net::HTTP::Get.new(uri)
|
62
|
-
request['Authorization'] = "Bearer #{@api_token}" if
|
63
|
-
request['User-Agent'] = @user_agent if
|
69
|
+
request['Authorization'] = "Bearer #{@api_token}" if api_token?
|
70
|
+
request['User-Agent'] = @user_agent if user_agent?
|
64
71
|
http.request(request)
|
65
72
|
}
|
66
73
|
|
data/lib/camdram/organisation.rb
CHANGED
@@ -3,6 +3,7 @@ require 'camdram/api'
|
|
3
3
|
require 'camdram/image'
|
4
4
|
require 'camdram/news'
|
5
5
|
require 'camdram/show'
|
6
|
+
require 'camdram/diary'
|
6
7
|
|
7
8
|
module Camdram
|
8
9
|
class Organisation < Base
|
@@ -51,6 +52,15 @@ module Camdram
|
|
51
52
|
split_object( response, Show )
|
52
53
|
end
|
53
54
|
|
55
|
+
# Gets a diary object which contains an array of upcoming calendar events for the organisation
|
56
|
+
#
|
57
|
+
# @return [Camdram::Diary] A Diary object.
|
58
|
+
def diary()
|
59
|
+
url = "#{self.class.url}/#{slug}/diary.json"
|
60
|
+
response = get(url)
|
61
|
+
Diary.new(response)
|
62
|
+
end
|
63
|
+
|
54
64
|
# Returns the URL+slug of the organisation
|
55
65
|
#
|
56
66
|
# @return [String] The full URL and slug.
|
data/lib/camdram/venue.rb
CHANGED
@@ -2,6 +2,7 @@ require 'camdram/base'
|
|
2
2
|
require 'camdram/api'
|
3
3
|
require 'camdram/news'
|
4
4
|
require 'camdram/show'
|
5
|
+
require 'camdram/diary'
|
5
6
|
|
6
7
|
module Camdram
|
7
8
|
class Venue < Base
|
@@ -45,6 +46,15 @@ module Camdram
|
|
45
46
|
split_object( response, Show )
|
46
47
|
end
|
47
48
|
|
49
|
+
# Gets a diary object which contains an array of upcoming calendar events for the venue
|
50
|
+
#
|
51
|
+
# @return [Camdram::Diary] A Diary object.
|
52
|
+
def diary()
|
53
|
+
url = "#{self.class.url}/#{slug}/diary.json"
|
54
|
+
response = get(url)
|
55
|
+
Diary.new(response)
|
56
|
+
end
|
57
|
+
|
48
58
|
# Returns the URL+slug of the venue
|
49
59
|
#
|
50
60
|
# @return [String] The full URL and slug.
|
data/lib/camdram/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camdram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Jonas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|