veezi-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: afb4383553009a859ded7656136b52fd1a16ec9b
4
+ data.tar.gz: 15a0fb2c042040f9c11b8f6e7dd3ec720a081a9c
5
+ SHA512:
6
+ metadata.gz: fe6af932f120ee9bdb90fdd78974c3cdfccab0d9d59bc4940be7b7f67ed4c532a67989a3db32c8beb7ddfa75381262ad90e56b0551c3879249b76505b6a084e5
7
+ data.tar.gz: 67af80c033fef566a3a1ed43215eaf2a3c0ba57bad497d52fe1884560d942d3f639f6955e5c1b4c2e37db1cee964467bceb655eb9e3db8757dec27f3b384c41b
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .rbenv-gemsets
19
+ .ruby-version
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in veezi-ruby.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Carlos Rodriguez
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Veezi::Ruby
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'veezi-ruby'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install veezi-ruby
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,31 @@
1
+ require "veezi/version"
2
+ require "veezi/errors"
3
+ require "veezi/configuration"
4
+ require "veezi/client"
5
+ require "veezi/api/base"
6
+ require "veezi/api/parser"
7
+ require "veezi/api/sessions"
8
+ require "veezi/api/films"
9
+ require "veezi/api/web_sessions"
10
+
11
+ module Veezi
12
+ class << self
13
+ def configure(config = nil)
14
+ if config
15
+ config.each do |k,v|
16
+ configuration.send("#{k}=", v) rescue nil if configuration.respond_to?("#{k}=")
17
+ end
18
+ end
19
+
20
+ yield(configuration) if block_given?
21
+ end
22
+
23
+ def configuration
24
+ @configuration ||= Veezi::Configuration.new
25
+ end
26
+
27
+ def client
28
+ @client = Veezi::Client.new
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,47 @@
1
+ require 'rest_client'
2
+
3
+ module Veezi
4
+ module API
5
+ class Base
6
+ attr_accessor :api_path
7
+ attr_reader :client
8
+ attr_reader :parser
9
+
10
+ def initialize(client)
11
+ @client = client
12
+ @parser = Veezi::API::Parser.new(self.client.configuration.content_type)
13
+ end
14
+
15
+ def all
16
+ response = request(:get, self.base_url)
17
+ self.parser.parse(response)
18
+ end
19
+
20
+ def find(id)
21
+ response = request(:get, "#{self.base_url}/#{id}")
22
+ self.parser.parse(response)
23
+ end
24
+
25
+ protected
26
+ def configuration
27
+ self.client.configuration
28
+ end
29
+
30
+ def content_type
31
+ self.client.configuration.content_type || :json
32
+ end
33
+
34
+ def base_url
35
+ "#{self.client.configuration.endpoint_url}/#{self.client.configuration.api_version}#{self.api_path}"
36
+ end
37
+
38
+ def access_token_header
39
+ { "VeeziAccessToken" => self.client.configuration.api_key }
40
+ end
41
+
42
+ def request(method, url, options = {})
43
+ RestClient.send(method, url, options.merge({ :accept => self.content_type }.merge(access_token_header)))
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,10 @@
1
+ module Veezi
2
+ module API
3
+ class Films < Base
4
+ def initialize(client)
5
+ @api_path = "/film"
6
+ super(client)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,26 @@
1
+ require 'crack'
2
+
3
+ module Veezi
4
+ module API
5
+ class Parser
6
+ def initialize(content_type = nil)
7
+ @content_type = content_type || :json
8
+ end
9
+
10
+ def parse(content)
11
+ case @content_type.to_sym
12
+ when :xml
13
+ hash = Crack::XML.parse(content)
14
+
15
+ if key = hash.keys.find { |key| key =~ /ArrayOf/ }
16
+ hash.fetch(key, {}).delete_if { |k,v| k.include?("xml") }.values.flatten
17
+ else
18
+ hash.values.first || {}
19
+ end
20
+ else
21
+ Crack::JSON.parse(content)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ module Veezi
2
+ module API
3
+ class Sessions < Base
4
+ def initialize(client)
5
+ @api_path = "/session"
6
+ super(client)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Veezi
2
+ module API
3
+ class WebSessions < Base
4
+ def initialize(client)
5
+ @api_path = "/websession"
6
+ super(client)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ module Veezi
2
+ class Client
3
+ attr_reader :configuration
4
+
5
+ def initialize
6
+ @configuration = Veezi.configuration
7
+
8
+ raise InvalidConfiguration unless @configuration.valid?
9
+ end
10
+
11
+ def sessions
12
+ @sessions ||= Veezi::API::Sessions.new(self)
13
+ end
14
+
15
+ def films
16
+ @films ||= Veezi::API::Films.new(self)
17
+ end
18
+
19
+ def web_sessions
20
+ @web_sessions ||= Veezi::API::WebSessions.new(self)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ module Veezi
2
+ class Configuration
3
+ REQUIRED_ATTRIUBTES = %w(api_key endpoint_url)
4
+
5
+ attr_accessor :api_key
6
+ attr_accessor :use_ssl
7
+ attr_accessor :endpoint_url
8
+ attr_accessor :content_type
9
+ attr_accessor :api_version
10
+
11
+ def initialize
12
+ @api_version ||= "V1"
13
+ @endpoint_url ||= "api.us.veezi.com"
14
+ end
15
+
16
+ def valid?
17
+ REQUIRED_ATTRIUBTES.all? { |attribute| !self.send(attribute).nil? }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module Veezi
2
+ class InvalidConfiguration < StandardError; end
3
+ end
@@ -0,0 +1,3 @@
1
+ module Veezi
2
+ VERSION = File.read(File.join(File.dirname(__FILE__), "../../VERSION")).strip
3
+ end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Films API Resource" do
4
+ before do
5
+ Veezi.configure do |config|
6
+ config.api_key = "1234567890"
7
+ config.endpoint_url = "http://planetargon.com"
8
+ end
9
+
10
+ @client = Veezi.client
11
+ end
12
+
13
+ context "JSON" do
14
+ before do
15
+ Veezi.configure do |config|
16
+ config.content_type = :json
17
+ end
18
+ end
19
+
20
+
21
+ context "All" do
22
+ before do
23
+ response = File.new(File.dirname(__FILE__) + '/fixtures/json/films.json')
24
+ stub_request(:get, /.*planetargon.com.*/).to_return(:body => lambda { |request| response } )
25
+ end
26
+
27
+ it "should return an array" do
28
+ expect(@client.films.all).to be_an_instance_of(Array)
29
+ end
30
+
31
+ it "should have three films" do
32
+ expect(@client.films.all.size).to eq 3
33
+ end
34
+
35
+ it "should have Avatar, Chronicle, and Blade Runner as the film title names" do
36
+ expect(@client.films.all.map { |movie| movie["Title"] } ).to match_array ["Avatar", "Chronicle", "Blade Runner"]
37
+ end
38
+
39
+ it "should have 162, 84, and 117 as the film durations" do
40
+ expect(@client.films.all.map { |movie| movie["Duration"] } ).to match_array [162, 84, 117]
41
+ end
42
+ end
43
+
44
+ context "Find" do
45
+ before do
46
+ response = File.new(File.dirname(__FILE__) + '/fixtures/json/film.json')
47
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
48
+ end
49
+
50
+ it "should return a hash" do
51
+ expect(@client.films.find("ST00000032")).to be_an_instance_of(Hash)
52
+ end
53
+
54
+ it "should have Avatar as the movie title" do
55
+ expect(@client.films.find("ST00000032")["Title"]).to eq "Avatar"
56
+ end
57
+
58
+ end
59
+ end
60
+
61
+ context "XML" do
62
+ before do
63
+ Veezi.configure do |config|
64
+ config.content_type = :xml
65
+ end
66
+ end
67
+
68
+ context "All" do
69
+ before do
70
+ response = File.new(File.dirname(__FILE__) + '/fixtures/xml/films.xml')
71
+ stub_request(:get, /.*planetargon.com.*/).to_return(:body => lambda { |request| response } )
72
+ end
73
+
74
+ it "should return an array" do
75
+ expect(@client.films.all).to be_an_instance_of(Array)
76
+ end
77
+
78
+ it "should have three films" do
79
+ expect(@client.films.all.size).to eq 3
80
+ end
81
+
82
+ it "should have Avatar, Chronicle, and Blade Runner as the film title names" do
83
+ expect(@client.films.all.map { |movie| movie["Title"] } ).to match_array ["Avatar", "Chronicle", "Blade Runner"]
84
+ end
85
+
86
+ it "should have 162, 84, and 117 as the film durations" do
87
+ expect(@client.films.all.map { |movie| movie["Duration"] } ).to match_array ["162", "84", "117"]
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,36 @@
1
+ {
2
+ "Id":"ST00000032",
3
+ "Title":"Avatar",
4
+ "ShortName":"Avatar",
5
+ "Synopsis":"A paraplegic Marine dispatched to the moon Pandora on a unique mission becomes torn between following his orders and protecting the world he feels is his home.",
6
+ "Genre":"Action",
7
+ "SignageText":"Avatar",
8
+ "Distributor":"20th Century Fox",
9
+ "OpeningDate":"2009-09-17T00:00:00",
10
+ "Rating":"PG13",
11
+ "Status":"Active",
12
+ "Content":"Restricted to persons 13 years and over",
13
+ "Duration":162,
14
+ "DisplaySequence":22,
15
+ "NationalCode":null,
16
+ "People":[
17
+ {
18
+ "Id":"0000000032",
19
+ "FirstName":"Sam",
20
+ "LastName":"Worthington",
21
+ "Role":"Actor"
22
+ },
23
+ {
24
+ "Id":"HO00000176",
25
+ "FirstName":"James",
26
+ "LastName":"Cameron",
27
+ "Role":"Dicrector"
28
+ },
29
+ {
30
+ "Id":"HO00000578",
31
+ "FirstName":"Sigourney",
32
+ "LastName":"Weaver",
33
+ "Role":"Actor"
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,69 @@
1
+ [
2
+ {
3
+ "Id":"ST00000032",
4
+ "Title":"Avatar",
5
+ "ShortName":"Avatar",
6
+ "Synopsis":"A paraplegic Marine dispatched to the moon Pandora on a unique mission becomes torn between following his orders and protecting the world he feels is his home.",
7
+ "Genre":"Action",
8
+ "SignageText":"Avatar",
9
+ "Distributor":"20th Century Fox",
10
+ "OpeningDate":"2009-09-17T00:00:00",
11
+ "Rating":"PG13",
12
+ "Status":"Active",
13
+ "Content":"Restricted to persons 13 years and over",
14
+ "Duration":162,
15
+ "NationalCode":null,
16
+ "People":[
17
+ {
18
+ "Id":"0000000032",
19
+ "FirstName":"Sam",
20
+ "LastName":"Worthington",
21
+ "Role":"Actor"
22
+ },
23
+ {
24
+ "Id":"HO00000176",
25
+ "FirstName":"James",
26
+ "LastName":"Cameron",
27
+ "Role":"Director"
28
+ },
29
+ {
30
+ "Id":"HO00000578",
31
+ "FirstName":"Sigourney",
32
+ "LastName":"Weaver",
33
+ "Role":"Actor"
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "Id":"ST00000065",
39
+ "Title":"Chronicle",
40
+ "ShortName":"Chronicle",
41
+ "Synopsis":"Three high school friends gain superpowers after making an incredible discovery. Soon, though, they find their lives spinning out of control and their bond tested as they embrace their darker sides.",
42
+ "Genre":"Drama",
43
+ "SignageText":"Chronicle",
44
+ "Distributor":"20th Century Fox",
45
+ "OpeningDate":"2012-03-15T16:39:25",
46
+ "Rating":"M -V",
47
+ "Status":"Active",
48
+ "Content":"M Contains violence.",
49
+ "Duration":84,
50
+ "NationalCode":"",
51
+ "People":[]
52
+ },
53
+ {
54
+ "Id":"ST00000074",
55
+ "Title":"Blade Runner",
56
+ "ShortName":"Blade Runn",
57
+ "Synopsis":"Deckard, a blade runner, has to track down and terminate 4 replicants who hijacked a ship in space and have returned to earth seeking their maker.",
58
+ "Genre":"Drama",
59
+ "SignageText":"Blade Runner",
60
+ "Distributor":"Warner Bros Pictures",
61
+ "OpeningDate":"1982-06-25T16:29:09",
62
+ "Rating":"R",
63
+ "Status":"Active",
64
+ "Content":"Restricted to persons over 16 years of age unless accompanied by a parent or guardian.",
65
+ "Duration":117,
66
+ "NationalCode":"",
67
+ "People":[]
68
+ }
69
+ ]
@@ -0,0 +1,24 @@
1
+ {
2
+ "Id":429,
3
+ "FilmId":"ST00000005",
4
+ "FilmPackageId":null,
5
+ "Title":"Women on the 6th Floor",
6
+ "ScreenId":1,
7
+ "Seating":"Open",
8
+ "AreComplimentariesAllowed":true,
9
+ "ShowType":"Public",
10
+ "SalesVia":
11
+ [
12
+ "WWW",
13
+ "POS"
14
+ ],
15
+ "Status":"Open",
16
+ "PreShowStartTime":"2013-08-01T14:00:00",
17
+ "FeatureStartTime":"2013-08-01T14:10:00",
18
+ "FeatureEndTime":"2013-08-01T15:54:00",
19
+ "CleanupEndTime":"2013-08-01T15:54:00",
20
+ "SeatsAvailable":106,
21
+ "SeatsHeld":0,
22
+ "SeatsHouse":0,
23
+ "SeatsSold":0
24
+ }
@@ -0,0 +1,49 @@
1
+ [
2
+ {
3
+ "Id":702,
4
+ "FilmId":"ST00000069",
5
+ "FilmPackageId":null,
6
+ "Title":"Contraband",
7
+ "ScreenId":2,
8
+ "Seating":"Select",
9
+ "AreComplimentariesAllowed":true,
10
+ "ShowType":"Public",
11
+ "SalesVia":
12
+ [
13
+ "WWW",
14
+ "POS"
15
+ ],
16
+ "Status":"Open",
17
+ "PreShowStartTime":"2013-06-28T17:00:00",
18
+ "FeatureStartTime":"2013-06-28T17:00:00",
19
+ "FeatureEndTime":"2013-06-28T18:49:00",
20
+ "CleanupEndTime":"2013-06-28T18:49:00",
21
+ "SeatsAvailable":70,
22
+ "SeatsHeld":0,
23
+ "SeatsHouse":3,
24
+ "SeatsSold":2
25
+ },
26
+ {
27
+ "Id":703,
28
+ "FilmId":"ST00000047",
29
+ "FilmPackageId":null,
30
+ "Title":"The Godfather",
31
+ "ScreenId":2,
32
+ "Seating":"Open",
33
+ "AreComplimentariesAllowed":true,
34
+ "ShowType":"Public",
35
+ "SalesVia":
36
+ [
37
+ "POS"
38
+ ],
39
+ "Status":"Open",
40
+ "PreShowStartTime":"2013-06-28T12:15:00",
41
+ "FeatureStartTime":"2013-06-28T12:15:00",
42
+ "FeatureEndTime":"2013-06-28T14:05:00",
43
+ "CleanupEndTime":"2013-06-28T14:05:00",
44
+ "SeatsAvailable":72,
45
+ "SeatsHeld":0,
46
+ "SeatsHouse":3,
47
+ "SeatsSold":0
48
+ }
49
+ ]
@@ -0,0 +1,51 @@
1
+ [
2
+ {
3
+ "Id":702,
4
+ "FilmId":"ST00000069",
5
+ "FilmPackageId":null,
6
+ "Title":"Contraband",
7
+ "ScreenId":2,
8
+ "Seating":"Select",
9
+ "AreComplimentariesAllowed":true,
10
+ "ShowType":"Public",
11
+ "URL":"http://planetargon.com",
12
+ "SalesVia":
13
+ [
14
+ "WWW",
15
+ "POS"
16
+ ],
17
+ "Status":"Open",
18
+ "PreShowStartTime":"2013-06-28T17:00:00",
19
+ "FeatureStartTime":"2013-06-28T17:00:00",
20
+ "FeatureEndTime":"2013-06-28T18:49:00",
21
+ "CleanupEndTime":"2013-06-28T18:49:00",
22
+ "SeatsAvailable":70,
23
+ "SeatsHeld":0,
24
+ "SeatsHouse":3,
25
+ "SeatsSold":2
26
+ },
27
+ {
28
+ "Id":703,
29
+ "FilmId":"ST00000047",
30
+ "FilmPackageId":null,
31
+ "Title":"The Godfather",
32
+ "ScreenId":2,
33
+ "Seating":"Open",
34
+ "AreComplimentariesAllowed":true,
35
+ "ShowType":"Public",
36
+ "URL":"http://planetargon.com",
37
+ "SalesVia":
38
+ [
39
+ "POS"
40
+ ],
41
+ "Status":"Open",
42
+ "PreShowStartTime":"2013-06-28T12:15:00",
43
+ "FeatureStartTime":"2013-06-28T12:15:00",
44
+ "FeatureEndTime":"2013-06-28T14:05:00",
45
+ "CleanupEndTime":"2013-06-28T14:05:00",
46
+ "SeatsAvailable":72,
47
+ "SeatsHeld":0,
48
+ "SeatsHouse":3,
49
+ "SeatsSold":0
50
+ }
51
+ ]
@@ -0,0 +1,72 @@
1
+ <ArrayOfFilm xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vista.Online.BackOffice.Api.Models.V1">
2
+ <Film>
3
+ <Content>Restricted to persons 13 years and over</Content>
4
+ <DisplaySequence>22</DisplaySequence>
5
+ <Distributor>20th Century Fox</Distributor>
6
+ <Duration>162</Duration>
7
+ <Genre>Action</Genre>
8
+ <Id>ST00000032</Id>
9
+ <NationalCode i:nil="true"></NationalCode>
10
+ <OpeningDate>2009-09-17T00:00:00</OpeningDate>
11
+ <People>
12
+ <Person>
13
+ <FirstName>Sam</FirstName>
14
+ <Id>0000000032</Id>
15
+ <LastName>Worthington</LastName>
16
+ <Role>Actor</Role>
17
+ </Person>
18
+ <Person>
19
+ <FirstName>James</FirstName>
20
+ <Id>HO00000176</Id>
21
+ <LastName>Cameron</LastName>
22
+ <Role>Dicrector</Role>
23
+ </Person>
24
+ <Person>
25
+ <FirstName>Sigourney</FirstName>
26
+ <Id>HO00000578</Id>
27
+ <LastName>Weaver</LastName>
28
+ <Role>Actor</Role>
29
+ </Person>
30
+ </People>
31
+ <Rating>PG13</Rating>
32
+ <ShortName>Avatar</ShortName>
33
+ <SignageText>Avatar</SignageText>
34
+ <Status>Active</Status>
35
+ <Synopsis>A paraplegic Marine dispatched to the moon Pandora on a unique mission becomes torn between following his orders and protecting the world he feels is his home.</Synopsis>
36
+ <Title>Avatar</Title>
37
+ </Film>
38
+ <Film>
39
+ <Content>M Contains violence.</Content>
40
+ <DisplaySequence>50</DisplaySequence>
41
+ <Distributor>20th Century Fox</Distributor>
42
+ <Duration>84</Duration>
43
+ <Genre>Drama</Genre>
44
+ <Id>ST00000065</Id>
45
+ <NationalCode></NationalCode>
46
+ <OpeningDate>2012-03-15T16:39:25</OpeningDate>
47
+ <People></People>
48
+ <Rating>M -V</Rating>
49
+ <ShortName>Chronicle</ShortName>
50
+ <SignageText>Chronicle</SignageText>
51
+ <Status>Active</Status>
52
+ <Synopsis>Three high school friends gain superpowers after making an incredible discovery. Soon, though, they find their lives spinning out of control and their bond tested as they embrace their darker sides.</Synopsis>
53
+ <Title>Chronicle</Title>
54
+ </Film>
55
+ <Film>
56
+ <Content>Restricted to persons over 16 years of age unless accompanied by a parent or guardian.</Content>
57
+ <DisplaySequence>50</DisplaySequence>
58
+ <Distributor>Warner Bros Pictures</Distributor>
59
+ <Duration>117</Duration>
60
+ <Genre>Drama</Genre>
61
+ <Id>ST00000022</Id>
62
+ <NationalCode i:nil="true"></NationalCode>
63
+ <OpeningDate>2013-03-01T00:00:00</OpeningDate>
64
+ <People></People>
65
+ <Rating>R</Rating>
66
+ <ShortName>Blade Runn</ShortName>
67
+ <SignageText>Blade Runner</SignageText>
68
+ <Status>Deleted</Status>
69
+ <Synopsis>Deckard, a blade runner, has to track down and terminate 4 replicants who hijacked a ship in space and have returned to earth seeking their maker.</Synopsis>
70
+ <Title>Blade Runner</Title>
71
+ </Film>
72
+ </ArrayOfFilm>
@@ -0,0 +1,23 @@
1
+ <Session xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vista.Online.BackOffice.Api.Models.V1">
2
+ <AreComplimentariesAllowed>true</AreComplimentariesAllowed>
3
+ <CleanupEndTime>2013-08-01T15:54:00</CleanupEndTime>
4
+ <FeatureEndTime>2013-08-01T15:54:00</FeatureEndTime>
5
+ <FeatureStartTime>2013-08-01T14:10:00</FeatureStartTime>
6
+ <FilmId>ST00000005</FilmId>
7
+ <FilmPackageId i:nil="true"></FilmPackageId>
8
+ <Id>429</Id>
9
+ <PreShowStartTime>2013-08-01T14:00:00</PreShowStartTime>
10
+ <SalesVia>
11
+ <SalesChannel>WWW</SalesChannel>
12
+ <SalesChannel>POS</SalesChannel>
13
+ </SalesVia>
14
+ <ScreenId>1</ScreenId>
15
+ <Seating>Open</Seating>
16
+ <SeatsAvailable>106</SeatsAvailable>
17
+ <SeatsHeld>0</SeatsHeld>
18
+ <SeatsHouse>0</SeatsHouse>
19
+ <SeatsSold>0</SeatsSold>
20
+ <ShowType>Public</ShowType>
21
+ <Status>Open</Status>
22
+ <Title>Women on the 6th Floor</Title>
23
+ </Session>
@@ -0,0 +1,47 @@
1
+ <ArrayOfSession xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vista.Online.BackOffice.Api.Models.V1">
2
+ <Session>
3
+ <AreComplimentariesAllowed>true</AreComplimentariesAllowed>
4
+ <CleanupEndTime>2013-06-28T18:49:00</CleanupEndTime>
5
+ <FeatureEndTime>2013-06-28T18:49:00</FeatureEndTime>
6
+ <FeatureStartTime>2013-06-28T17:00:00</FeatureStartTime>
7
+ <FilmId>ST00000069</FilmId>
8
+ <FilmPackageId i:nil="true"></FilmPackageId>
9
+ <Id>702</Id>
10
+ <PreShowStartTime>2013-06-28T17:00:00</PreShowStartTime>
11
+ <SalesVia>
12
+ <SalesChannel>WWW</SalesChannel>
13
+ <SalesChannel>POS</SalesChannel>
14
+ </SalesVia>
15
+ <ScreenId>2</ScreenId>
16
+ <Seating>Select</Seating>
17
+ <SeatsAvailable>70</SeatsAvailable>
18
+ <SeatsHeld>0</SeatsHeld>
19
+ <SeatsHouse>3</SeatsHouse>
20
+ <SeatsSold>2</SeatsSold>
21
+ <ShowType>Public</ShowType>
22
+ <Status>Open</Status>
23
+ <Title>Contraband</Title>
24
+ </Session>
25
+ <Session>
26
+ <AreComplimentariesAllowed>true</AreComplimentariesAllowed>
27
+ <CleanupEndTime>2013-06-28T14:05:00</CleanupEndTime>
28
+ <FeatureEndTime>2013-06-28T14:05:00</FeatureEndTime>
29
+ <FeatureStartTime>2013-06-28T12:15:00</FeatureStartTime>
30
+ <FilmId>ST00000047</FilmId>
31
+ <FilmPackageId i:nil="true"></FilmPackageId>
32
+ <Id>703</Id>
33
+ <PreShowStartTime>2013-06-28T12:15:00</PreShowStartTime>
34
+ <SalesVia>
35
+ <SalesChannel>POS</SalesChannel>
36
+ </SalesVia>
37
+ <ScreenId>2</ScreenId>
38
+ <Seating>Open</Seating>
39
+ <SeatsAvailable>72</SeatsAvailable>
40
+ <SeatsHeld>0</SeatsHeld>
41
+ <SeatsHouse>3</SeatsHouse>
42
+ <SeatsSold>0</SeatsSold>
43
+ <ShowType>Public</ShowType>
44
+ <Status>Open</Status>
45
+ <Title>The Godfather</Title>
46
+ </Session>
47
+ </ArrayOfSession>
@@ -0,0 +1,49 @@
1
+ <ArrayOfSession xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vista.Online.BackOffice.Api.Models.V1">
2
+ <Session>
3
+ <AreComplimentariesAllowed>true</AreComplimentariesAllowed>
4
+ <CleanupEndTime>2013-06-28T18:49:00</CleanupEndTime>
5
+ <FeatureEndTime>2013-06-28T18:49:00</FeatureEndTime>
6
+ <FeatureStartTime>2013-06-28T17:00:00</FeatureStartTime>
7
+ <FilmId>ST00000069</FilmId>
8
+ <FilmPackageId i:nil="true"></FilmPackageId>
9
+ <Id>702</Id>
10
+ <PreShowStartTime>2013-06-28T17:00:00</PreShowStartTime>
11
+ <SalesVia>
12
+ <SalesChannel>WWW</SalesChannel>
13
+ <SalesChannel>POS</SalesChannel>
14
+ </SalesVia>
15
+ <ScreenId>2</ScreenId>
16
+ <Seating>Select</Seating>
17
+ <SeatsAvailable>70</SeatsAvailable>
18
+ <SeatsHeld>0</SeatsHeld>
19
+ <SeatsHouse>3</SeatsHouse>
20
+ <SeatsSold>2</SeatsSold>
21
+ <ShowType>Public</ShowType>
22
+ <Status>Open</Status>
23
+ <Title>Contraband</Title>
24
+ <URL>http://planetargon.com</URL>
25
+ </Session>
26
+ <Session>
27
+ <AreComplimentariesAllowed>true</AreComplimentariesAllowed>
28
+ <CleanupEndTime>2013-06-28T14:05:00</CleanupEndTime>
29
+ <FeatureEndTime>2013-06-28T14:05:00</FeatureEndTime>
30
+ <FeatureStartTime>2013-06-28T12:15:00</FeatureStartTime>
31
+ <FilmId>ST00000047</FilmId>
32
+ <FilmPackageId i:nil="true"></FilmPackageId>
33
+ <Id>703</Id>
34
+ <PreShowStartTime>2013-06-28T12:15:00</PreShowStartTime>
35
+ <SalesVia>
36
+ <SalesChannel>POS</SalesChannel>
37
+ </SalesVia>
38
+ <ScreenId>2</ScreenId>
39
+ <Seating>Open</Seating>
40
+ <SeatsAvailable>72</SeatsAvailable>
41
+ <SeatsHeld>0</SeatsHeld>
42
+ <SeatsHouse>3</SeatsHouse>
43
+ <SeatsSold>0</SeatsSold>
44
+ <ShowType>Public</ShowType>
45
+ <Status>Open</Status>
46
+ <Title>The Godfather</Title>
47
+ <URL>http://planetargon.com</URL>
48
+ </Session>
49
+ </ArrayOfSession>
@@ -0,0 +1,104 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Sessions API Resource" do
4
+ before do
5
+ Veezi.configure do |config|
6
+ config.api_key = "1234567890"
7
+ config.endpoint_url = "http://planetargon.com"
8
+ end
9
+
10
+ @client = Veezi.client
11
+ end
12
+
13
+ context "JSON" do
14
+ before do
15
+ Veezi.configure do |config|
16
+ config.content_type = :json
17
+ end
18
+ end
19
+
20
+ context "All" do
21
+ before do
22
+ response = File.new(File.dirname(__FILE__) + '/fixtures/json/sessions.json')
23
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
24
+ end
25
+
26
+ it "should return an array" do
27
+ expect(@client.sessions.all).to be_an_instance_of(Array)
28
+ end
29
+
30
+ it "should have two films" do
31
+ expect(@client.sessions.all.size).to eq 2
32
+ end
33
+
34
+ it "should have Contraband and The Godfather as the film time title names" do
35
+ expect(@client.sessions.all.map { |movie| movie["Title"] } ).to match_array ["Contraband", "The Godfather"]
36
+ end
37
+ end
38
+
39
+ context "Find" do
40
+ before do
41
+ response = File.new(File.dirname(__FILE__) + '/fixtures/json/session.json')
42
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
43
+ end
44
+
45
+ it "should return a hash" do
46
+ expect(@client.sessions.find(429)).to be_an_instance_of(Hash)
47
+ end
48
+
49
+ it "should have Women on the 6th Floor as the movie title" do
50
+ expect(@client.sessions.find(429)["Title"]).to eq "Women on the 6th Floor"
51
+ end
52
+
53
+ it "should have a screen id of 1" do
54
+ expect(@client.sessions.find(429)["ScreenId"]).to eq 1
55
+ end
56
+ end
57
+ end
58
+
59
+ context "XML" do
60
+ before do
61
+ Veezi.configure do |config|
62
+ config.content_type = :xml
63
+ end
64
+ end
65
+
66
+ context "All" do
67
+ before do
68
+ response = File.new(File.dirname(__FILE__) + '/fixtures/xml/sessions.xml')
69
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
70
+ end
71
+
72
+ it "should return an array" do
73
+ expect(@client.sessions.all).to be_an_instance_of(Array)
74
+ end
75
+
76
+ it "should have two films" do
77
+ expect(@client.sessions.all.size).to eq 2
78
+ end
79
+
80
+ it "should have Contraband and The Godfather as the film time title names" do
81
+ expect(@client.sessions.all.map { |movie| movie["Title"] } ).to match_array ["Contraband", "The Godfather"]
82
+ end
83
+ end
84
+
85
+ context "Find" do
86
+ before do
87
+ response = File.new(File.dirname(__FILE__) + '/fixtures/xml/session.xml')
88
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
89
+ end
90
+
91
+ it "should return a hash" do
92
+ expect(@client.sessions.find(429)).to be_an_instance_of(Hash)
93
+ end
94
+
95
+ it "should have Women on the 6th Floor as the movie title" do
96
+ expect(@client.sessions.find(429)["Title"]).to eq "Women on the 6th Floor"
97
+ end
98
+
99
+ it "should have a screen id of 1" do
100
+ expect(@client.sessions.find(429)["ScreenId"]).to eq "1"
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Web Sessions API Resource" do
4
+ before do
5
+ Veezi.configure do |config|
6
+ config.api_key = "1234567890"
7
+ config.endpoint_url = "http://planetargon.com"
8
+ end
9
+
10
+ @client = Veezi.client
11
+ end
12
+
13
+ context "JSON" do
14
+ before do
15
+ Veezi.configure do |config|
16
+ config.content_type = :json
17
+ end
18
+ end
19
+
20
+ context "All" do
21
+ before do
22
+ response = File.new(File.dirname(__FILE__) + '/fixtures/json/web_sessions.json')
23
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
24
+ end
25
+
26
+ it "should return an array" do
27
+ expect(@client.web_sessions.all).to be_an_instance_of(Array)
28
+ end
29
+
30
+ it "should have two films" do
31
+ expect(@client.web_sessions.all.size).to eq 2
32
+ end
33
+
34
+ it "should have Contraband and The Godfather as the film time title names" do
35
+ expect(@client.web_sessions.all.map { |movie| movie["Title"] } ).to match_array ["Contraband", "The Godfather"]
36
+ end
37
+
38
+ it "should have http://planetargon as the URL" do
39
+ expect(@client.web_sessions.all.map { |movie| movie["URL"] } ).to match_array ["http://planetargon.com", "http://planetargon.com"]
40
+ end
41
+ end
42
+ end
43
+
44
+ context "XML" do
45
+ before do
46
+ Veezi.configure do |config|
47
+ config.content_type = :xml
48
+ end
49
+ end
50
+
51
+ context "All" do
52
+ before do
53
+ response = File.new(File.dirname(__FILE__) + '/fixtures/xml/web_sessions.xml')
54
+ stub_request(:get, /.*planetargon.com.*/).to_return { { :body => response } }
55
+ end
56
+
57
+ it "should return an array" do
58
+ expect(@client.web_sessions.all).to be_an_instance_of(Array)
59
+ end
60
+
61
+ it "should have two films" do
62
+ expect(@client.web_sessions.all.size).to eq 2
63
+ end
64
+
65
+ it "should have Contraband and The Godfather as the film time title names" do
66
+ expect(@client.web_sessions.all.map { |movie| movie["Title"] } ).to match_array ["Contraband", "The Godfather"]
67
+ end
68
+
69
+ it "should have http://planetargon as the URL" do
70
+ expect(@client.web_sessions.all.map { |movie| movie["URL"] } ).to match_array ["http://planetargon.com", "http://planetargon.com"]
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Veezi Client" do
4
+ before do
5
+ Veezi.configure do |config|
6
+ config.api_key = nil
7
+ end
8
+ end
9
+
10
+ it "should raise an InvalidConfiguration exception if the configuration is invalid" do\
11
+ expect { Veezi.client }.to raise_error Veezi::InvalidConfiguration
12
+ end
13
+
14
+ it "should not raise and InvalidConfiguration exception if the configuration is valid" do
15
+ Veezi.configure do |config|
16
+ config.api_key = 'client_key'
17
+ config.endpoint_url = 'endpoint'
18
+ end
19
+
20
+ expect { Veezi.client }.not_to raise_error
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Configuration Settings" do
4
+ it "should have an api key when defined" do
5
+ Veezi.configure do |config|
6
+ config.api_key = "1234567890"
7
+ end
8
+
9
+ expect(Veezi.configuration.api_key).to eq "1234567890"
10
+ end
11
+
12
+ it "should have an api key when defined via hash" do
13
+ Veezi.configure api_key: '1234567890'
14
+
15
+ expect(Veezi.configuration.api_key).to eq "1234567890"
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ require 'veezi'
2
+ require 'webmock/rspec'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+
7
+ config.before :suite do
8
+ WebMock.allow_net_connect!
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'veezi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "veezi-ruby"
8
+ spec.version = Veezi::VERSION
9
+ spec.authors = ["Carlos Rodriguez"]
10
+ spec.email = ["carlos@eddorre.com"]
11
+ spec.description = %q{Ruby Gem to consume Veezi API}
12
+ spec.summary = %q{Ruby Gem to consume Veezi API}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rest-client", "~> 1.6"
22
+ spec.add_dependency "crack", "~> 0.4"
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec", "~> 2.14"
26
+ spec.add_development_dependency "webmock", "~> 1.15"
27
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: veezi-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Rodriguez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: crack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '2.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '2.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.15'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.15'
97
+ description: Ruby Gem to consume Veezi API
98
+ email:
99
+ - carlos@eddorre.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - VERSION
110
+ - lib/veezi.rb
111
+ - lib/veezi/api/base.rb
112
+ - lib/veezi/api/films.rb
113
+ - lib/veezi/api/parser.rb
114
+ - lib/veezi/api/sessions.rb
115
+ - lib/veezi/api/web_sessions.rb
116
+ - lib/veezi/client.rb
117
+ - lib/veezi/configuration.rb
118
+ - lib/veezi/errors.rb
119
+ - lib/veezi/version.rb
120
+ - spec/api/films_spec.rb
121
+ - spec/api/fixtures/json/film.json
122
+ - spec/api/fixtures/json/films.json
123
+ - spec/api/fixtures/json/session.json
124
+ - spec/api/fixtures/json/sessions.json
125
+ - spec/api/fixtures/json/web_sessions.json
126
+ - spec/api/fixtures/xml/films.xml
127
+ - spec/api/fixtures/xml/session.xml
128
+ - spec/api/fixtures/xml/sessions.xml
129
+ - spec/api/fixtures/xml/web_sessions.xml
130
+ - spec/api/sessions_spec.rb
131
+ - spec/api/web_sessions_spec.rb
132
+ - spec/client_spec.rb
133
+ - spec/configuration_spec.rb
134
+ - spec/spec_helper.rb
135
+ - veezi-ruby.gemspec
136
+ homepage: ''
137
+ licenses:
138
+ - MIT
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.0.3
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Ruby Gem to consume Veezi API
160
+ test_files:
161
+ - spec/api/films_spec.rb
162
+ - spec/api/fixtures/json/film.json
163
+ - spec/api/fixtures/json/films.json
164
+ - spec/api/fixtures/json/session.json
165
+ - spec/api/fixtures/json/sessions.json
166
+ - spec/api/fixtures/json/web_sessions.json
167
+ - spec/api/fixtures/xml/films.xml
168
+ - spec/api/fixtures/xml/session.xml
169
+ - spec/api/fixtures/xml/sessions.xml
170
+ - spec/api/fixtures/xml/web_sessions.xml
171
+ - spec/api/sessions_spec.rb
172
+ - spec/api/web_sessions_spec.rb
173
+ - spec/client_spec.rb
174
+ - spec/configuration_spec.rb
175
+ - spec/spec_helper.rb