storenvy 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -8,6 +8,13 @@ Installation
8
8
  gem install storenvy
9
9
 
10
10
 
11
+ Usage
12
+ -------------
13
+
14
+ client = Storenvy::Client.new
15
+ store = client.store("tonkapark")
16
+
17
+
11
18
  Supported Rubies
12
19
  ----------------
13
20
  * 1.8.7
@@ -17,7 +24,7 @@ Supported Rubies
17
24
  Change Log
18
25
  ==========
19
26
 
20
- 0.0.1 - August 2nd 2012
27
+ 0.0.2 - August 2nd 2012
21
28
  --------------
22
29
  * just starting out.
23
30
 
@@ -8,8 +8,8 @@ module Storenvy
8
8
  include HTTParty
9
9
  headers 'Content-Type' => 'application/json'
10
10
 
11
- def initialize(options={})
12
- end
11
+ def initialize(options={})
12
+ end
13
13
 
14
14
  def self.fetch(path)
15
15
  response = get(path)
@@ -18,10 +18,12 @@ module Storenvy
18
18
 
19
19
  def self.list(path, opts={})
20
20
  response = get(path, :query => {'limit' => opts[:limit]})
21
- response.map { |c| Hashie::Mash.new(c)}
21
+ response.map { |c| Hashie::Mash.new(c) }
22
22
  end
23
23
 
24
-
24
+ def store(subdomain, opts={})
25
+ store = self.class.fetch("http://#{subdomain}.storenvy.com/store.json")
26
+ end
25
27
  ##############################################
26
28
  ## HELPERS
27
29
  private
@@ -1,3 +1,3 @@
1
1
  module Storenvy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1 @@
1
+ {"subdomain":"tonkapark","url":"http://tonkapark.storenvy.com","avatar":"https://dpegb9ebondhq.cloudfront.net/stores/avatars/13191/medium/265180_211719242198498_203921722978250_543289_6720284_n.jpg?1317913497"}
data/spec/helper.rb CHANGED
@@ -2,3 +2,11 @@ require File.expand_path('../../lib/storenvy', __FILE__)
2
2
  require 'rubygems'
3
3
  require 'rspec'
4
4
  require 'webmock/rspec'
5
+
6
+ def fixture_path
7
+ File.expand_path("../fixtures", __FILE__)
8
+ end
9
+
10
+ def fixture(file)
11
+ File.new(fixture_path + '/' + file)
12
+ end
@@ -1,4 +1,68 @@
1
1
  require 'helper'
2
2
 
3
3
  describe Storenvy do
4
- end
4
+
5
+ it "will delegate Storenvy.new to client " do
6
+ client = Storenvy.new
7
+ client.should be_an_instance_of Storenvy::Client
8
+ end
9
+
10
+ end
11
+
12
+
13
+ describe Storenvy::Client do
14
+
15
+ before do
16
+
17
+ stub_request(:get, "tonkapark.storenvy.com/store.json").
18
+ to_return(:body=>fixture("store.json"), :headers => {:content_type => "application/json; charset=utf-8"})
19
+
20
+ end
21
+
22
+ describe "client" do
23
+ before(:each) do
24
+ @client = Storenvy::Client.new
25
+ end
26
+
27
+ it "is properly classed" do
28
+ @client.should be_an_instance_of Storenvy::Client
29
+ end
30
+
31
+ it "can fetch" do
32
+ store = Storenvy::Client.fetch("http://tonkapark.storenvy.com/store.json")
33
+ a_request(:get, "tonkapark.storenvy.com/store.json").should have_been_made
34
+ end
35
+
36
+ end
37
+
38
+
39
+ describe ".store" do
40
+ before do
41
+ @client = Storenvy::Client.new
42
+ end
43
+
44
+ it "with no options makes 1 http call" do
45
+ store = @client.store("tonkapark")
46
+ a_request(:get, "tonkapark.storenvy.com/store.json").should have_been_made
47
+ end
48
+
49
+
50
+ context "will be a valid hash" do
51
+ before{@store = @client.store("tonkapark")}
52
+
53
+ it {@store.should be_a Hash}
54
+
55
+ it "should have a url" do
56
+ @store.url.should be_an String
57
+ @store.url.should eq("http://tonkapark.storenvy.com")
58
+ end
59
+
60
+ it {@store.url.should be_a String}
61
+ it {@store.avatar.should be_a String}
62
+ it {@store.subdomain.should be_a String}
63
+
64
+ end
65
+
66
+ end
67
+
68
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storenvy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
17
- requirement: &2153872040 !ruby/object:Gem::Requirement
17
+ requirement: &2161693020 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.8.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2153872040
25
+ version_requirements: *2161693020
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: hashie
28
- requirement: &2153871420 !ruby/object:Gem::Requirement
28
+ requirement: &2161692460 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2153871420
36
+ version_requirements: *2161692460
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec
39
- requirement: &2153871040 !ruby/object:Gem::Requirement
39
+ requirement: &2161692040 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2153871040
47
+ version_requirements: *2161692040
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: webmock
50
- requirement: &2153870460 !ruby/object:Gem::Requirement
50
+ requirement: &2161691580 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2153870460
58
+ version_requirements: *2161691580
59
59
  description: A Ruby wrapper for the Storenvy REST API
60
60
  email:
61
61
  - matt@tonkapark.com
@@ -70,6 +70,7 @@ files:
70
70
  - lib/storenvy.rb
71
71
  - lib/storenvy/client.rb
72
72
  - lib/storenvy/version.rb
73
+ - spec/fixtures/store.json
73
74
  - spec/helper.rb
74
75
  - spec/storenvy_spec.rb
75
76
  - storenvy.gemspec
@@ -99,5 +100,6 @@ signing_key:
99
100
  specification_version: 3
100
101
  summary: Ruby wrapper for the Storenvy API
101
102
  test_files:
103
+ - spec/fixtures/store.json
102
104
  - spec/helper.rb
103
105
  - spec/storenvy_spec.rb