ean-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,24 @@
1
+ = Ean
2
+ === Expedia Affiliate Network REST API for RAILS.
3
+
4
+ If you don't have registered application in EAN developers network, then you'll do it here:
5
+ https://developer.ean.com/member/register
6
+
7
+ == Installation
8
+
9
+ Create new file 'app/config/initializers/ean.rb' with the following code:
10
+ Ean::API.make('YOUR_API_CID', 'YOUR_API_KEY', 'YOUR_API_SHARED_SECRET', PARAMS = {})
11
+ Where:
12
+ 'YOUR_API_CID' (55505 - for beta testing), 'YOUR_API_KEY' and 'YOUR_API_SHARED_SECRET' is required, params is optional.
13
+
14
+ Allowed PARAMS:
15
+ :version => EAN_API_VERSION (by default used "3")
16
+ :minor_rev => EAN_API_MINOR_REVISION (by default used "4")
17
+ :locale => EAN_API_LOCALE (by default used "en_US")
18
+ :currency_code => EAN_API_CURRENCY_CODE (by default used "USD")
19
+ :sig => EAN_API_SIGNATURE (by default used "")
20
+
21
+ For more details see EAN Endpoints & Common Elements docs:
22
+ http://developer.ean.com/docs/read/hotels/version_3/Endpoints_amp_Common_Elements
23
+
24
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Ean'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
data/lib/ean.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'ean/request'
2
+ require 'ean/response'
3
+ require 'ean/hotel'
4
+
5
+ module Ean
6
+ end
data/lib/ean/api.rb ADDED
@@ -0,0 +1,33 @@
1
+ module Ean
2
+ class API
3
+ attr_accessor :key,
4
+ :cid,
5
+ :secret,
6
+ :version,
7
+ :locale,
8
+ :minor_rev,
9
+ :currency_code,
10
+ :customer_session_id,
11
+ :customer_ip_address,
12
+ :customer_user_agent,
13
+ :sig
14
+
15
+ @@instance = nil
16
+
17
+ def self.make(cid, key, secret, params={})
18
+ @@instance = self.new
19
+ @@instance.cid = cid
20
+ @@instance.key = key
21
+ @@instance.sig = params[:sig].present? ? params[:sig] : ""
22
+ @@instance.secret = secret
23
+ @@instance.version = params[:version].present? ? params[:version] : "3"
24
+ @@instance.locale = params[:locale].present? ? params[:locale] : "en_US"
25
+ @@instance.minor_rev = params[:minor_rev].present? ? params[:minor_rev] : "4"
26
+ @@instance.currency_code = params[:currency_code].present? ? params[:currency_code] : "USD"
27
+ end
28
+
29
+ def self.instance
30
+ @@instance
31
+ end
32
+ end
33
+ end
data/lib/ean/hotel.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'ean/request'
2
+
3
+ module Ean
4
+ class Hotel
5
+ attr_accessor :request, :response
6
+
7
+ def self.list(params={})
8
+ instance = self.new("list")
9
+ end
10
+
11
+ def initialize(method="")
12
+ @request = Ean::Request.new(method)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ require "ean/api"
2
+
3
+ module Ean
4
+ class Request
5
+ attr_accessor :base_url, :api
6
+
7
+ def initialize(method="")
8
+ @api = Ean::API.instance
9
+ @base_url = "http://api.ean.com/ean-services/rs/hotel/v#{api.version}/#{method}?cid=#{api.cid}&apiKey=#{api.key}\
10
+ &locale=#{api.locale}&currencyCode=#{api.currency_code}&minorRev=#{api.minor_rev}"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ module Ean
2
+ class Response
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Ean
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ean do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ean-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Juri Semjonov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.9
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.9
30
+ - !ruby/object:Gem::Dependency
31
+ name: httparty
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Expedia Affiliate Network REST API
47
+ email:
48
+ - js@codegears.co
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/ean.rb
54
+ - lib/ean/hotel.rb
55
+ - lib/ean/api.rb
56
+ - lib/ean/request.rb
57
+ - lib/ean/response.rb
58
+ - lib/ean/version.rb
59
+ - lib/tasks/ean_tasks.rake
60
+ - MIT-LICENSE
61
+ - Rakefile
62
+ - README.rdoc
63
+ homepage: https://github.com/Semjonow/ean
64
+ licenses: []
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.23
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Expedia Affiliate Network REST API
87
+ test_files: []