dawanda_client 0.1.7 → 0.1.8

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/LICENSE CHANGED
File without changes
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ The Dawanda gem provides a friendly Ruby interface to the Dawanda API
8
8
   
9
9
  Installing the latest stable version is simple:
10
10
 
11
- sudo gem install dawanda-dawanda_client --source=http://gems.github.com
11
+ sudo gem install dawanda_client --source=http://gemcutter.org
12
12
 
13
13
  == Usage
14
14
 
data/Rakefile CHANGED
@@ -36,10 +36,13 @@ begin
36
36
  gemspec.name = "dawanda_client"
37
37
  gemspec.summary = "Provides a friendly ruby-like interface to the Dawanda API"
38
38
  gemspec.description = "Provides a friendly ruby-like interface to the Dawanda API"
39
- gemspec.email = 'info@christophbuente.de'
40
- gemspec.homepage = "http://github.com/dawanda/dawanda_client"
41
- gemspec.authors = ['Christoph Bünte']
39
+ gemspec.email = 'api@dawanda.com'
40
+ gemspec.homepage = "http://github.com/dawanda/dawanda-api-client-ruby"
41
+ gemspec.authors = ['DaWanda GmbH']
42
+
43
+ gemspec.files.exclude 'examples/*'
44
+ gemspec.test_files.exclude 'examples/*'
42
45
  end
43
46
  rescue LoadError
44
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
47
+ puts "Jeweler not available. Install it with: gem install jeweler"
45
48
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -1,24 +1,23 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dawanda_client}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Christoph B\303\274nte"]
12
- s.date = %q{2009-10-13}
11
+ s.authors = ["DaWanda GmbH"]
12
+ s.date = %q{2010-03-08}
13
13
  s.description = %q{Provides a friendly ruby-like interface to the Dawanda API}
14
- s.email = %q{info@christophbuente.de}
14
+ s.email = %q{api@dawanda.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".gitignore",
21
- "LICENSE",
20
+ "LICENSE",
22
21
  "README.rdoc",
23
22
  "Rakefile",
24
23
  "VERSION",
@@ -47,10 +46,10 @@ Gem::Specification.new do |s|
47
46
  "test/unit/dawanda/user_test.rb",
48
47
  "test/unit/dawanda_test.rb"
49
48
  ]
50
- s.homepage = %q{http://github.com/dawanda/dawanda_client}
49
+ s.homepage = %q{http://github.com/dawanda/dawanda-api-client-ruby}
51
50
  s.rdoc_options = ["--charset=UTF-8"]
52
51
  s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.5}
52
+ s.rubygems_version = %q{1.3.6}
54
53
  s.summary = %q{Provides a friendly ruby-like interface to the Dawanda API}
55
54
  s.test_files = [
56
55
  "test/test_helper.rb",
@@ -73,3 +72,4 @@ Gem::Specification.new do |s|
73
72
  else
74
73
  end
75
74
  end
75
+
File without changes
File without changes
data/lib/dawanda/color.rb CHANGED
File without changes
data/lib/dawanda/model.rb CHANGED
@@ -3,29 +3,32 @@ module Dawanda
3
3
 
4
4
  module ClassMethods
5
5
 
6
- def attribute(name, options = {})
7
- from = parse_from(name,options)
8
- if from.is_a? Array
6
+ def attribute(name, options=nil)
7
+ options = name if options.nil?
8
+ if options.is_a? Array
9
9
  class_eval <<-CODE
10
10
  def #{name}
11
- @result['#{from.first}']['#{from.last}']
11
+ @result#{to_result_string(options)}
12
12
  end
13
13
  CODE
14
14
  else
15
15
  class_eval <<-CODE
16
16
  def #{name}
17
- @result['#{from}']
17
+ @result['#{options}']
18
18
  end
19
19
  CODE
20
20
  end
21
21
  end
22
-
23
- def parse_from(name,options)
24
- from = options.fetch(:from,name)
25
- return from unless from.is_a? Hash
26
- key = from.keys.first
27
- value = from.fetch(key)
28
- [key,value]
22
+
23
+ def to_result_string options
24
+ options.map! do |o|
25
+ if o.is_a? Numeric
26
+ "[#{o}]"
27
+ else
28
+ "['#{o}']"
29
+ end
30
+ end
31
+ options.join
29
32
  end
30
33
 
31
34
  def attributes(*names)
@@ -30,9 +30,9 @@ module Dawanda
30
30
 
31
31
  finder :one, '/products/:id'
32
32
 
33
- attribute :created, :from => :created_at
34
- attribute :category_id, :from => {:category => :id }
35
- attribute :user_id, :from => {:user => :id }
33
+ attribute :created, :created_at
34
+ attribute :category_id, [ :category, :id ]
35
+ attribute :user_id, [ :user => :id ]
36
36
 
37
37
  attributes :id, :name, :description, :created_at, :view_count, :tags,
38
38
  :ending, :quantity, :materials, :price, :restful_path, :product_url, :images
File without changes
File without changes
data/lib/dawanda/shop.rb CHANGED
@@ -19,10 +19,10 @@ module Dawanda
19
19
  finder :one, '/shops/:user_id'
20
20
  finder :all, '/shops/:method'
21
21
 
22
- attribute :updated, :from => :updated_at
23
- attribute :created, :from => :created_at
24
- attribute :user_id, :from => { :user => :id }
25
- attribute :banner_image_url, :from => { :images => :banner }
22
+ attribute :updated, :updated_at
23
+ attribute :created, :created_at
24
+ attribute :user_id, [:user, :id]
25
+ attribute :banner_image_url, [:images, 0, :shop_banner]
26
26
 
27
27
  attributes :name
28
28
 
File without changes
data/lib/dawanda/user.rb CHANGED
File without changes
data/lib/dawanda.rb CHANGED
File without changes
File without changes
File without changes
@@ -19,7 +19,7 @@
19
19
  "name":"MEKO STORE",
20
20
  "updated_at":"2009/09/29 09:58:46 +0000",
21
21
  "images": [
22
- {"banner":"http:\/\/img.dawanda.com.s3.amazonaws.com\/Shop\/1\/1592\/maxbanner\/1253807487-995.jpg"}
22
+ {"shop_banner":"http:\/\/img.dawanda.com.s3.amazonaws.com\/Shop\/1\/1592\/maxbanner\/1253807487-995.jpg"}
23
23
  ],
24
24
  "restful_path":"\/shops\/13008",
25
25
  "shop_categories": [
File without changes
data/test/test_helper.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -22,6 +22,7 @@ module Dawanda
22
22
  value_for :name, :is => 'MEKO STORE'
23
23
  value_for :updated, :is => "2009/09/29 09:58:46 +0000"
24
24
  value_for :created, :is => "2007/05/18 10:44:17 +0000"
25
+ value_for :banner_image_url, :is => "http://img.dawanda.com.s3.amazonaws.com/Shop/1/1592/maxbanner/1253807487-995.jpg"
25
26
  end
26
27
 
27
28
  should "know the creation date" do
File without changes
File without changes
metadata CHANGED
@@ -1,20 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dawanda_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 8
9
+ version: 0.1.8
5
10
  platform: ruby
6
11
  authors:
7
- - "Christoph B\xC3\xBCnte"
12
+ - DaWanda GmbH
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-10-13 00:00:00 +02:00
17
+ date: 2010-03-08 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
16
21
  description: Provides a friendly ruby-like interface to the Dawanda API
17
- email: info@christophbuente.de
22
+ email: api@dawanda.com
18
23
  executables: []
19
24
 
20
25
  extensions: []
@@ -23,7 +28,6 @@ extra_rdoc_files:
23
28
  - LICENSE
24
29
  - README.rdoc
25
30
  files:
26
- - .gitignore
27
31
  - LICENSE
28
32
  - README.rdoc
29
33
  - Rakefile
@@ -53,7 +57,7 @@ files:
53
57
  - test/unit/dawanda/user_test.rb
54
58
  - test/unit/dawanda_test.rb
55
59
  has_rdoc: true
56
- homepage: http://github.com/dawanda/dawanda_client
60
+ homepage: http://github.com/dawanda/dawanda-api-client-ruby
57
61
  licenses: []
58
62
 
59
63
  post_install_message:
@@ -65,18 +69,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
69
  requirements:
66
70
  - - ">="
67
71
  - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
68
74
  version: "0"
69
- version:
70
75
  required_rubygems_version: !ruby/object:Gem::Requirement
71
76
  requirements:
72
77
  - - ">="
73
78
  - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
74
81
  version: "0"
75
- version:
76
82
  requirements: []
77
83
 
78
84
  rubyforge_project:
79
- rubygems_version: 1.3.5
85
+ rubygems_version: 1.3.6
80
86
  signing_key:
81
87
  specification_version: 3
82
88
  summary: Provides a friendly ruby-like interface to the Dawanda API
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- doc
2
- pkg