Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/gem-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build and Publish to RubyGems

on:
push:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.5

- run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
17 changes: 17 additions & 0 deletions .github/workflows/gem-version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Verify Gem Version Change

on:
pull_request:
branches: [ master ]

jobs:
build:
name: Version Check
runs-on: ubuntu-latest

steps:
- name: Version Forget Me Not
uses: simplybusiness/version-forget-me-not@v2
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_FILE_PATH: "lib/schema_dot_org/version.rb"
15 changes: 10 additions & 5 deletions lib/schema_dot_org.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def attrs_and_values
attrs.map do |attr|
# Skip both id and @id since we handle @id separately in to_json_struct
next if attr.to_s == "id" || attr.to_s == "@id"

attr_string = attr.to_s.delete_prefix('@')

attr_name = snake_case_to_lower_camel_case(attr_string).sub('queryInput', 'query-input')
attr_value = instance_variable_get(attr)

[attr_name, resolve_value(attr_value)]
end.compact.to_h
end
Expand All @@ -97,7 +97,7 @@ def resolve_value(value)

elsif is_schema_type?(value)
value.to_json_struct

else
value
end
Expand Down Expand Up @@ -135,6 +135,7 @@ def rails_production?
require 'schema_dot_org/thing'
require 'schema_dot_org/item_list'
require 'schema_dot_org/list_item'
require 'schema_dot_org/postal_address'
require 'schema_dot_org/organization'
require 'schema_dot_org/place'
require 'schema_dot_org/product'
Expand All @@ -145,4 +146,8 @@ def rails_production?
require 'schema_dot_org/web_page'
require 'schema_dot_org/answer'
require 'schema_dot_org/question'
require 'schema_dot_org/faq_page'
require 'schema_dot_org/faq_page'
require 'schema_dot_org/entry_point'
require 'schema_dot_org/insurance_agency'
require 'schema_dot_org/quote_action'
require 'schema_dot_org/service'
1 change: 1 addition & 0 deletions lib/schema_dot_org/contact_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ContactPoint < SchemaType
validated_attr :available_language, type: Array, allow_nil: true
validated_attr :contact_option, type: String, allow_nil: true
validated_attr :contact_type, type: String, presence: true
validated_attr :email, type: String, allow_nil: true
validated_attr :telephone, type: String, presence: true
end
end
6 changes: 6 additions & 0 deletions lib/schema_dot_org/entry_point.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module SchemaDotOrg
class EntryPoint < SchemaType
validated_attr :action_platform, type: Array
validated_attr :url_template, type: String
end
end
5 changes: 5 additions & 0 deletions lib/schema_dot_org/insurance_agency.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module SchemaDotOrg
class InsuranceAgency < SchemaDotOrg::Organization
validated_attr :potential_action, type: SchemaDotOrg::Action, allow_nil: true
end
end
3 changes: 2 additions & 1 deletion lib/schema_dot_org/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

module SchemaDotOrg
class Organization < SchemaType
validated_attr :contact_points, type: Array, allow_nil: true
validated_attr :address, type: SchemaDotOrg::PostalAddress, allow_nil: true
validated_attr :contact_point, type: Array, allow_nil: true
validated_attr :email, type: String, allow_nil: true
validated_attr :founder, type: SchemaDotOrg::Person, allow_nil: true
validated_attr :founding_date, type: Date, allow_nil: true
Expand Down
9 changes: 9 additions & 0 deletions lib/schema_dot_org/postal_address.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module SchemaDotOrg
class PostalAddress < SchemaType
validated_attr :street_address, type: String
validated_attr :address_locality, type: String
validated_attr :address_region, type: String
validated_attr :postal_code, type: String
validated_attr :address_country, type: String
end
end
7 changes: 7 additions & 0 deletions lib/schema_dot_org/quote_action.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module SchemaDotOrg
class QuoteAction < SchemaDotOrg::Action
validated_attr :name, type: String
validated_attr :description, type: String
validated_attr :object, type: SchemaDotOrg::Thing
end
end
5 changes: 5 additions & 0 deletions lib/schema_dot_org/service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module SchemaDotOrg
class Service < SchemaDotOrg::Thing
validated_attr :name, type: String
end
end
3 changes: 3 additions & 0 deletions lib/schema_dot_org/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SchemaDotOrg
VERSION = "2.23.1"
end
3 changes: 2 additions & 1 deletion schema_dot_org.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
lib = File.expand_path('lib', __dir__)

$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'schema_dot_org/version'

Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.6'
spec.name = 'schema_dot_org'
spec.version = '2.2.3'
spec.version = SchemaDotOrg::VERSION
spec.authors = ['Robb Shecter']
spec.email = ['robb@public.law']

Expand Down
Loading