auchandirect-scrAPI 0.1.0 → 0.1.1

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: cc35cb08d3c9467fe51c720cd6d154286627d478
4
- data.tar.gz: f13f7199fa84e7f6093d4fac3d97772108ac52f6
3
+ metadata.gz: e4f04d459a19fb29b837fc67d14fb9be671b049e
4
+ data.tar.gz: 29f59965eb06cf07a737008a099f8cd0743b25ae
5
5
  SHA512:
6
- metadata.gz: cec302e8fbaf7f1ad245f94cf0f8a483c2f712328e6ba512a49438cfc88be7b154e20f5d00b38dcc9b5b82e146ad264c3fd7dbf8cdc55eada15a3c8ead3e9c8b
7
- data.tar.gz: c924a934ffda7b7b4d3040fcb123c9f5fa590e473b974c072870db8a7d8d904eb166dd50e915baa04314cab4531dd1edff533b2c90eaf1b046e31e4b6495c605
6
+ metadata.gz: 01bdecbbde94cf407a4bd703134c65dd9200f25138d4662896119e6220491802f7a7bfe114c12571562ba8ce566ac1a1a3468a0de2d39565f301d6fca66d751d
7
+ data.tar.gz: eb06be216471dcb79327f3961144669d1ea0d9116f7a0c4db4a8c2ac7de6eea38dd4b1f3dd98a950b94ad1a0b18f119fb342958867e01cf1aeaf957e0e1f5dd5
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,17 +1,12 @@
1
1
  language: ruby
2
- rvm:
3
- - ruby-head
4
- - 2.1.1
5
- - 2.0.0
6
- - jruby-head
7
- - jruby-21mode
8
- - jruby-20mode
9
2
  script: bundle exec rake
10
3
  matrix:
11
- allow_failures:
12
- - rvm: ruby-head
13
- # no lazy for enumerators in jruby
14
- - rvm: jruby-head
15
- - rvm: jruby-21mode
16
- - rvm: jruby-20mode
17
-
4
+ include:
5
+ - rvm: 2.1.1
6
+ env:
7
+ - AUCHANDIRECT_TEST_EMAIL=auchandirect.scrapi.211@mailinator.com
8
+ - AUCHANDIRECT_TEST_PASSWORD=123secret
9
+ - rvm: 2.0.0
10
+ env:
11
+ - AUCHANDIRECT_TEST_EMAIL=auchandirect.scrapi.200@mailinator.com
12
+ - AUCHANDIRECT_TEST_PASSWORD=123secret
data/README.md CHANGED
@@ -19,8 +19,8 @@ Or install it yourself as:
19
19
  ## Status
20
20
 
21
21
  This library should be production ready.
22
- * It is automaticaly tested through Travis[https://travis-ci.org/philou/auchandirect-scrAPI]
23
- * It should be daily tested through TravisCron[http://traviscron.pythonanywhere.com/] to quickly detect modification at auchandirect.fr
22
+ * It is automaticaly tested through [Travis](https://travis-ci.org/philou/auchandirect-scrAPI)
23
+ * It should be daily tested through [TravisCron](http://traviscron.pythonanywhere.com/) to quickly detect modification at www.auchandirect.fr
24
24
 
25
25
  ## Usage
26
26
 
@@ -29,6 +29,7 @@ This API has 2 main features :
29
29
  * Connecting with a user account in order to fill his cart
30
30
 
31
31
  It is not currently possible to pay and validate an order through this API. In order to do so, a user must :
32
+
32
33
  1. first disconnect from the API
33
34
  2. only then reconnect with his account through a browser, and order his pre-filled cart
34
35
 
@@ -66,11 +67,11 @@ end
66
67
 
67
68
  ### Client side usage
68
69
 
69
- In order to make it possible for a web browser to automaticaly connect to auchandirect.fr (for example in an iframe, to pay for a cart that was previously filled with this gem on the server), the cart The Auchandirect::ScrAPI::Cart classes exposes enough information to generate the html that makes this possible. You can have a look at spec/lib/auchandirect/scrAPI/client_cart_shared_examples.rb for more details. /This whole thing remains tricky and subject to failures though./
70
+ In order to make it possible for a web browser to automaticaly connect to auchandirect.fr (for example in an iframe, to pay for a cart that was previously filled with this gem on the server), the Auchandirect::ScrAPI::Cart class exposes enough information to generate the html that makes this possible. You can have a look at spec/lib/auchandirect/scrAPI/client_cart_shared_examples.rb for more details. *This whole thing remains tricky and subject to failures though.*
70
71
 
71
- ### Testing
72
+ ### Mocking
72
73
 
73
- In order to run quicker and offline tests for the rest of your app, you can use Auchandirect::ScrAPI::DummyCart in place of a real cart. This cart is compatible with Storexplore's dummy store generators [https://github.com/philou/storexplore].
74
+ In order to run quicker and offline tests for the rest of your app, you can use Auchandirect::ScrAPI::DummyCart in place of a real cart. This cart is compatible with Storexplore's dummy store generators (see https://github.com/philou/storexplore).
74
75
 
75
76
  ## Contributing
76
77
 
@@ -79,3 +80,26 @@ In order to run quicker and offline tests for the rest of your app, you can use
79
80
  3. Commit your changes (`git commit -am 'Add some feature'`)
80
81
  4. Push to the branch (`git push origin my-new-feature`)
81
82
  5. Create new Pull Request
83
+
84
+ ### Running the tests
85
+
86
+ * If you want to run the tests, you'll need valid auchandirect credentials. So first, head up to www.auchandirect.fr and create yourself an account if you don't yet have one.
87
+ * To run guard or rspec, you'll have to specify these credentials through environment variables :
88
+
89
+ ```shell
90
+ AUCHANDIRECT_TEST_EMAIL=me@mail.com AUCHANDIRECT_TEST_PASSWORD=secret bundle exec rspec spec
91
+ ```
92
+
93
+ * If you get tired of repeating this, you can create yourself a 'credentials' shell script at the root of the repo :
94
+
95
+ ```bash
96
+ #!/bin/sh
97
+ AUCHANDIRECT_TEST_EMAIL=me@mail.com AUCHANDIRECT_TEST_PASSWORD=secret "$@"
98
+ ```
99
+
100
+ * Make it exectuable ```chmod +x credentials```
101
+ * You can now simply run any command with your credentials
102
+
103
+ ```shell
104
+ ./credentials bundle exec rspec spec
105
+ ```
@@ -21,7 +21,7 @@
21
21
 
22
22
  module Auchandirect
23
23
  module ScrAPI
24
- VERSION = "0.1.0"
24
+ VERSION = "0.1.1"
25
25
  end
26
26
  end
27
27
 
@@ -30,11 +30,19 @@ when_online("AuchanDirectApi remote spec") do
30
30
 
31
31
  module AuchanDirectApiCredentials
32
32
  def valid_email
33
- "mes.courses.fr.test@gmail.com"
33
+ check_credentials
34
+ ENV['AUCHANDIRECT_TEST_EMAIL']
34
35
  end
35
36
  def valid_password
36
- # gmail password : "mes*courses"
37
- "mescourses"
37
+ check_credentials
38
+ ENV['AUCHANDIRECT_TEST_PASSWORD']
39
+ end
40
+
41
+ private
42
+ def check_credentials
43
+ if ENV['AUCHANDIRECT_TEST_EMAIL'].to_s.empty? or ENV['AUCHANDIRECT_TEST_PASSWORD'].to_s.empty?
44
+ raise RuntimeError.new("Please specify valid auchandirect credentials with env AUCHANDIRECT_TEST_EMAIL and AUCHANDIRECT_TEST_PASSWORD when running these specs")
45
+ end
38
46
  end
39
47
  end
40
48
  # force autoload of AuchanDirectApi
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auchandirect-scrAPI
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philou
@@ -31,7 +31,7 @@ cert_chain:
31
31
  yLcl1cmm5ALtJ/+Bkkmp0i4amXeTDMvq9r8PBsVsQwxYOYJBP+Umxz3PX6HjFHrQ
32
32
  XdkXx3oZ
33
33
  -----END CERTIFICATE-----
34
- date: 2014-03-21 00:00:00.000000000 Z
34
+ date: 2014-03-31 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: storexplore
metadata.gz.sig CHANGED
Binary file