somefixtures 0.0.1 → 0.1.0

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
@@ -13,21 +13,24 @@ Install
13
13
 
14
14
  Usage
15
15
  -----
16
-
17
16
  foo = Fixture.new(
18
- :save_to => "/Users/jbw/project/spec/fixtures/",
19
- :format => "json",
20
- :base_uri => "http://github.com/api/v2/json",
21
- :login => "jbw",
22
- :token => "YOUR_AUTHENTICATION_API_TOKEN" )
23
-
24
- foo.add("/user/search/jbw", "search")
25
- foo.add("/user/show/jbw", "show_unauthenticated")
26
- foo.add("/user/show/jbw", "show_authenticated", true)
27
- foo.add("/user/show/jbw/following", "following")
28
- foo.add("/user/show/jbw/followers", "followers")
29
-
30
- foo.make_fixtures!
17
+ :save_to => "/Users/jbw/Desktop/",
18
+ :format => "json",
19
+ :base_uri => "http://github.com/api/v2/json",
20
+ :login => "jbw",
21
+ :token => "d6c339d410e3e35917f3c40caba8f241" )
22
+
23
+ foo.add(:get, "/user/search/jbw", "search")
24
+ foo.add_get("/user/search/jbw", "search")
25
+
26
+ foo.add_get("/user/show/jbw", "show_unauthenticated")
27
+ foo.add_get("/user/show/jbw", "show_authenticated", true)
28
+ foo.add_get("/user/show/jbw/followers", "followers")
29
+
30
+ foo.add(:post, "/user/follow/jbw", "follow", true)
31
+ foo.add_post("/user/follow/jbw", "follow", true)
32
+
33
+ foo.make_fixtures!
31
34
 
32
35
  Licence
33
36
  -------
data/Rakefile CHANGED
@@ -26,7 +26,7 @@ spec = Gem::Specification.new do |s|
26
26
  s.homepage = "http://github.com/jbw/somefixtures/"
27
27
  s.require_paths = %w[lib]
28
28
  s.rubyforge_project = 'somefixtures'
29
- s.add_dependency('HTTParty', '>= 0.6.1' )
29
+ s.add_dependency('httparty', '>= 0.6.1' )
30
30
  end
31
31
 
32
32
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -15,26 +15,41 @@ module SomeFixtures
15
15
  @fixtures = {}
16
16
  end
17
17
 
18
- def add query, name, authenticate = false
18
+ def add option, query, name, authenticate=false
19
19
  @fixtures.each_key { |key| print name == key ? "You have added \"#{key}\" for a file name already. Each filename must be unique!\n" : nil }
20
- @fixtures[name] = { :query => query, :authenticate => authenticate }
20
+ @fixtures[name] = { :option => option, :query => query, :authenticate => authenticate }
21
21
  end
22
+
22
23
 
23
24
  def make_fixtures!
24
- save (get @fixtures)
25
+ save (query)
25
26
  end
26
-
27
+
28
+ def add_post(*args); add(:post, *args) end
29
+ def add_get(*args); add(:get, *args) end
30
+
27
31
  private
28
- def get fixtures
32
+
33
+ def query
29
34
  responses = []
30
-
31
35
  @fixtures.each_key do |name|
32
- responses << self.class.get( @base_uri + @fixtures[name][:query], :query => (authenticated? name) )
36
+ if @fixtures[name][:option] == :post
37
+ responses << (post name)
38
+ else
39
+ responses << (get name)
40
+ end
33
41
  end
34
-
35
42
  responses
36
43
  end
37
-
44
+
45
+ def get name
46
+ self.class.get( @base_uri + @fixtures[name][:query], :query => (authenticated? name) )
47
+ end
48
+
49
+ def post name
50
+ self.class.post( @base_uri + @fixtures[name][:query], :query => (authenticated? name) )
51
+ end
52
+
38
53
  def authenticated? name
39
54
  @authenticate = @fixtures[name][:authenticate];
40
55
  auth_params
data/somefixtures.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'somefixtures'
3
- s.version = '0.0.1'
3
+ s.version = '0.1.0'
4
4
  s.date = '2010-07-30'
5
5
  s.description = "Testing fixture automator. Easies the pain of getting sample data for testing."
6
6
  s.summary = s.description
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: somefixtures
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Watson