Skip to content

Commit

Permalink
Adds policy model
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Saunders committed Dec 9, 2014
1 parent 99ef4da commit b6afcd9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/shopify_api/resources/policy.rb
@@ -0,0 +1,7 @@
module ShopifyAPI
class Policy < Base
def self.all
find(:all)
end
end
end
4 changes: 2 additions & 2 deletions lib/shopify_api/resources/shop.rb
Expand Up @@ -3,9 +3,9 @@ module ShopifyAPI
# the shop.
class Shop < Base
def self.current
find(:one, :from => "/admin/shop.#{format.extension}")
find(:one, from: "/admin/shop.#{format.extension}")
end

def metafields
Metafield.find(:all)
end
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/policies.json
@@ -0,0 +1,8 @@
{
"policies": [
{
"title": "Privacy Policy",
"body": "Your privacy is important to us"
}
]
}
19 changes: 19 additions & 0 deletions test/policy_test.rb
@@ -0,0 +1,19 @@
require 'test_helper'

class PolicyTest < Test::Unit::TestCase
def setup
super
fake 'shop'
end

def test_getting_the_list_of_policies
fake 'policies'

policies = ShopifyAPI::Policy.all
assert_equal 1, policies.length

policy = policies.first
assert_equal 'Privacy Policy', policy.title
assert_equal 'Your privacy is important to us', policy.body
end
end

0 comments on commit b6afcd9

Please sign in to comment.