gapic-generator/lib/gapic/schema/service_config_parser.rb
def parse_http_rule rule_yaml
          rule = Google::Api::HttpRule.new
          rule.selector = rule_yaml[HTTP_RULES_SELECTOR_KEY] if rule_yaml.key? HTTP_RULES_SELECTOR_KEY
          verb_path = HTTP_RULES_VERBS_ALLOWED.find { |verb| rule_yaml[verb] }
          rule.send "#{verb_path}=", rule_yaml[verb_path] if verb_path
          rule.body = rule_yaml[HTTP_RULES_BODY_KEY] if rule_yaml.key? HTTP_RULES_BODY_KEY

          if rule_yaml.key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY
            rule.additional_bindings = rule_yaml[HTTP_RULES_ADDITIONAL_BINDINGS_KEY].map do |binding_yaml|
              parse_http_rule binding_yaml
            end
          end

          rule
        end
# Parses a single Http rule from yaml
# only supports a limited amount of fields
# NB: this method is recursive when parsing additional_bindings field
# @return [::Google::Api::HttpRule]
Parses a single Http rule from yaml
only supports a limited amount of fields
NB: this method is recursive when parsing additional_bindings field
Parses a single Http rule from yaml only supports a limited amount of fields NB : this method is recursive when parsing additional_bindings field
def parse_http_rule rule_yaml
          rule = Google::Api::HttpRule.new
          rule.selector = rule_yaml[HTTP_RULES_SELECTOR_KEY] if rule_yaml.key? HTTP_RULES_SELECTOR_KEY
          verb_path = HTTP_RULES_VERBS_ALLOWED.find { |verb| rule_yaml[verb] }
          rule.send "#{verb_path}=", rule_yaml[verb_path] if verb_path
          rule.body = rule_yaml[HTTP_RULES_BODY_KEY] if rule_yaml.key? HTTP_RULES_BODY_KEY
          if rule_yaml.key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY
            rule.additional_bindings = rule_yaml[HTTP_RULES_ADDITIONAL_BINDINGS_KEY].map do |binding_yaml|
              parse_http_rule binding_yaml
            end
          end
          rule
        end
def parse_http_rule rule_yaml rule = Google :: Api :: HttpRule . new rule . selector = rule_yaml [ HTTP_RULES_SELECTOR_KEY ] if rule_yaml . key? HTTP_RULES_SELECTOR_KEY verb_path = HTTP_RULES_VERBS_ALLOWED . find { | verb | rule_yaml [ verb ] } rule . send "#{verb_path}=" , rule_yaml [ verb_path ] if verb_path rule . body = rule_yaml [ HTTP_RULES_BODY_KEY ] if rule_yaml . key? HTTP_RULES_BODY_KEY if rule_yaml . key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY rule . additional_bindings = rule_yaml [ HTTP_RULES_ADDITIONAL_BINDINGS_KEY ] . map do | binding_yaml | parse_http_rule binding_yaml end end rule end
Parses a single Http rule from yaml
only supports a limited amount of fields
NB: this method is recursive when parsing additional_bindings field
Parses a single Http rule from yaml only supports a limited amount of fields NB : this method is recursive when parsing additional_bindings field
None
::Google::Api::HttpRule
rule_yaml