cantook 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d244a7cbf9c6ff39604a67e2e42345eb16937b4f
4
- data.tar.gz: 4b0daa97abbcacd2d4bfc8b76e27ec719f0edb8b
3
+ metadata.gz: f38a3da7839cd43d3948667028105db74fd9e9e4
4
+ data.tar.gz: 6ae7117f27bd7bd5a91c8882eaa2d77f05ee6bfd
5
5
  SHA512:
6
- metadata.gz: ab5364abb5bc5a740adbbdba2dea562f3d1a3f04e531b4c046ffae94bc84246676d7916ebc35fa8fdc1a822964314f37fd78f202ead14220a74498b6c6c633b6
7
- data.tar.gz: a9b62062f55b20e4ce0c8d14be435d56f13c2e9e572393dbf49f852ba955079f3c9e2c1495af58538a0106d02699b72e3bc56f219db04852fc339dd7990f41fb
6
+ metadata.gz: f1488f846f785e394953363d25684cfdbf5e14e2843227a0dd087181fb8578065cd0277d4ba8a71d3dd20e5ccb72c5ba9a5fe8b00eab08edca99b6c0d891f2a9
7
+ data.tar.gz: 01a020082b0c030f1ab47124ca6e7be7160155083fed21bf4b13ba5a7fa6f4dd0dfb65e6b14114050cb865c56387df018ab4f0e3dc7c3ff7e4d5bda5035ef316
data/README.md CHANGED
@@ -6,46 +6,106 @@ Facilitates Ruby and Ruby on Rails interaction with the Cantook API
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'cantook'
9
+ ``` ruby
10
+ gem 'cantook'
11
+ ```
10
12
 
11
13
  And then execute:
12
14
 
13
- $ bundle
15
+ ```
16
+ $ bundle
17
+ ```
14
18
 
15
19
  Or install it yourself as:
16
20
 
17
- $ gem install cantook
21
+ ```
22
+ $ gem install cantook
23
+ ```
18
24
 
19
25
  ## Usage
20
26
 
21
27
  ### Simulate a sale
22
- base_hash = { username: 'foo', password: 'bar', platform: 'www.cantook.net', organisation_id: 123, sale_state: 'test', format: 'epub', isbn: '123456789asdf' }
23
- simulate_hash = { cost: '999', protection: 'acs4', country: nil }
24
- cantook = Cantook::SimulateASale.new(base_hash)
25
-
26
- if cantook.simulate_a_sale(simulate_hash)
27
- puts "success"
28
- else
29
- puts "failure"
30
- end
28
+
29
+ ``` ruby
30
+ base_hash = {
31
+ username: 'foo',
32
+ password: 'bar',
33
+ platform: 'www.cantook.net',
34
+ organisation_id: 123,
35
+ sale_state: 'test',
36
+ format: 'epub',
37
+ isbn: '123456789asdf'
38
+ }
39
+
40
+ simulate_hash = {
41
+ cost: '999',
42
+ protection: 'acs4',
43
+ country: nil
44
+ }
45
+
46
+ cantook = Cantook::SimulateASale.new(base_hash)
47
+
48
+ if cantook.simulate_a_sale(simulate_hash)
49
+ puts "success"
50
+ else
51
+ puts "failure"
52
+ end
53
+ ```
31
54
 
32
55
  ### Sale of a publication
33
- base_hash = { username: 'foo', password: 'bar', platform: 'www.cantook.net', organisation_id: 123, sale_state 'test', format: 'epub', isbn: '123456789asdf' }
34
- sale_hash = { cost: '999', customer_id: '123', transaction_id: 'abc', protection: 'acs4' }
35
- cantook = Cantook::SaleOfAPublication.new(base_hash)
36
-
37
- if cantook.sale_of_a_publication(sale_hash)
38
- puts "success"
39
- else
40
- puts "failure"
41
- end
56
+
57
+ ``` ruby
58
+ base_hash = {
59
+ username: 'foo',
60
+ password: 'bar',
61
+ platform: 'www.cantook.net',
62
+ organisation_id: 123,
63
+ sale_state 'test',
64
+ format: 'epub',
65
+ isbn: '123456789asdf'
66
+ }
67
+
68
+ sale_hash = {
69
+ cost: '999',
70
+ customer_id: '123',
71
+ transaction_id: 'abc',
72
+ protection: 'acs4'
73
+ }
74
+
75
+ cantook = Cantook::SaleOfAPublication.new(base_hash)
76
+
77
+ if cantook.sale_of_a_publication(sale_hash)
78
+ puts "success"
79
+ else
80
+ puts "failure"
81
+ end
82
+ ```
42
83
 
43
84
  ### Download a publication
44
- base_hash = { username: 'foo', password: 'bar', platform: 'www.cantook.net', organisation_id: 123, sale_state: 'test', format: 'epub', isbn: '123456789asdf' }
45
- download_hash = { customer_id: '123', transaction_id: 'abc', uname: 'Foo Bar' }
46
- cantook = Cantook::DownloadAPublication.new(base_hash)
47
- download_link = cantook.download_a_publication(download_hash)
48
- redirect_to download_link
85
+
86
+ ``` ruby
87
+ base_hash = {
88
+ username: 'foo',
89
+ password: 'bar',
90
+ platform: 'www.cantook.net',
91
+ organisation_id: 123,
92
+ sale_state: 'test',
93
+ format: 'epub',
94
+ isbn: '123456789asdf'
95
+ }
96
+
97
+ download_hash = {
98
+ customer_id: '123',
99
+ transaction_id: 'abc',
100
+ uname: 'Foo Bar'
101
+ }
102
+
103
+ cantook = Cantook::DownloadAPublication.new(base_hash)
104
+
105
+ download_link = cantook.download_a_publication(download_hash)
106
+
107
+ redirect_to download_link
108
+ ```
49
109
 
50
110
  ## Contributing
51
111
 
@@ -53,4 +113,4 @@ Or install it yourself as:
53
113
  2. Create your feature branch (`git checkout -b my-new-feature`)
54
114
  3. Commit your changes (`git commit -am 'Add some feature'`)
55
115
  4. Push to the branch (`git push origin my-new-feature`)
56
- 5. Create new Pull Request
116
+ 5. Create new Pull Request
data/cantook.gemspec CHANGED
@@ -1,10 +1,15 @@
1
+ # Maintain your gem's version:
2
+
1
3
  # coding: utf-8
2
4
  lib = File.expand_path('../lib', __FILE__)
5
+
3
6
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
7
 
8
+ require "cantook/version"
9
+
5
10
  Gem::Specification.new do |spec|
6
11
  spec.name = "cantook"
7
- spec.version = "0.0.1"
12
+ spec.version = Cantook::VERSION
8
13
  spec.authors = ["Gordon B. Isnor"]
9
14
  spec.email = ["gordonbisnor@gmail.com"]
10
15
  spec.description = %q{Cantook gem}
data/lib/cantook/base.rb CHANGED
@@ -22,6 +22,7 @@ module Cantook
22
22
  :isbn,
23
23
  :format,
24
24
  :response,
25
+ :query,
25
26
  :sale_state
26
27
 
27
28
  # @param [Hash] params
@@ -52,13 +53,15 @@ module Cantook
52
53
 
53
54
  # @param [Hash] options
54
55
  def get_request options
55
- HTTParty.get(request_url, query: options.merge(base_options), basic_auth: auth)
56
+ self.query = options.merge(base_options)
57
+ HTTParty.get(request_url, query: query, basic_auth: auth)
56
58
  end
57
59
  private :get_request
58
60
 
59
61
  # @param [Hash] options
60
62
  def post_request options
61
- HTTParty.post(request_url, query: options.merge(base_options), basic_auth: auth)
63
+ self.query = options.merge(base_options)
64
+ HTTParty.post(request_url, query: query, basic_auth: auth)
62
65
  end
63
66
  private :post_request
64
67
 
@@ -72,6 +75,4 @@ module Cantook
72
75
  response.parsed_response.deep_symbolize_keys!
73
76
  end
74
77
 
75
- end
76
-
77
78
  end
@@ -0,0 +1,3 @@
1
+ module Cantook
2
+ VERSION = "0.0.2"
3
+ end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cantook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gordon B. Isnor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-31 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Cantook gem
@@ -59,7 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
@@ -70,6 +70,7 @@ files:
70
70
  - lib/cantook/download_a_publication.rb
71
71
  - lib/cantook/sale_of_a_publication.rb
72
72
  - lib/cantook/simulate_a_sale.rb
73
+ - lib/cantook/version.rb
73
74
  homepage: http://www.github.com/gordonbisnor/cantook
74
75
  licenses:
75
76
  - MIT
@@ -80,19 +81,18 @@ require_paths:
80
81
  - lib
81
82
  required_ruby_version: !ruby/object:Gem::Requirement
82
83
  requirements:
83
- - - '>='
84
+ - - ">="
84
85
  - !ruby/object:Gem::Version
85
86
  version: '0'
86
87
  required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  requirements:
88
- - - '>='
89
+ - - ">="
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
92
  requirements: []
92
93
  rubyforge_project:
93
- rubygems_version: 2.0.3
94
+ rubygems_version: 2.2.2
94
95
  signing_key:
95
96
  specification_version: 4
96
97
  summary: Facilitates Ruby and Ruby on Rails interactions with the Cantook API
97
98
  test_files: []
98
- has_rdoc: