typefront 0.1.1 → 0.2.1

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.
@@ -33,6 +33,14 @@ In your environment.rb:
33
33
 
34
34
  `TypeFront.remove_font(101)`
35
35
 
36
+ ### Activate a font format
37
+
38
+ `TypeFront.activate_format(101, 301)`
39
+
40
+ ### Disable a font format
41
+
42
+ `TypeFront.disable_format(101, 301)`
43
+
36
44
  ### Add new allowed domain
37
45
 
38
46
  `TypeFront.add_domain(101, 'http://somedomain.com')`
@@ -3,7 +3,7 @@ require 'restclient'
3
3
  require 'json'
4
4
 
5
5
  class TypeFront
6
- VERSION = '0.1.1'
6
+ VERSION = '0.2.1'
7
7
  DOMAIN = 'http://typefront.com'
8
8
 
9
9
  def initialize(email, password)
@@ -33,6 +33,14 @@ class TypeFront
33
33
  delete("/fonts/#{font_id}.json")
34
34
  end
35
35
 
36
+ def activate_format(font_id, format_id)
37
+ put("/fonts/#{font_id}/formats/#{format_id}.json", :font_format => { :active => true })
38
+ end
39
+
40
+ def disable_format(font_id, format_id)
41
+ put("/fonts/#{font_id}/formats/#{format_id}.json", :font_format => { :active => false })
42
+ end
43
+
36
44
  def add_domain(font_id, domain)
37
45
  post("/fonts/#{font_id}/domains.json", :domain => { :domain => domain })
38
46
  end
@@ -44,7 +52,7 @@ class TypeFront
44
52
  private
45
53
 
46
54
  def method_missing(name, *args)
47
- if [:get, :post, :delete].include?(name)
55
+ if [:get, :post, :put, :delete].include?(name)
48
56
  send(:send_request, name, args[0], args[1] || {})
49
57
  else
50
58
  super
@@ -38,6 +38,20 @@ describe TypeFront do
38
38
  end
39
39
  end
40
40
 
41
+ describe 'activate_format' do
42
+ it 'should run successfully' do
43
+ RestClient::Resource.any_instance.expects(:put)
44
+ @typefront.activate_format(101, 301)
45
+ end
46
+ end
47
+
48
+ describe 'disable_format' do
49
+ it 'should run successfully' do
50
+ RestClient::Resource.any_instance.expects(:put)
51
+ @typefront.disable_format(101, 301)
52
+ end
53
+ end
54
+
41
55
  describe 'add_domain' do
42
56
  it 'should run successfully' do
43
57
  RestClient::Resource.any_instance.expects(:post)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 2
7
8
  - 1
8
- - 1
9
- version: 0.1.1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Small Spark
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-28 00:00:00 +10:00
17
+ date: 2010-08-12 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency